static double[] bwImage_averageBrightnessPerRow(BWImage img) { int w = img.getWidth(), h = img.getHeight(); double[] l = new[h]; for y to h: { double sum = 0; for x to w: sum += img.getFloatPixel(x, y); l[y] = sum/w; } ret l; }