static float blackHigh_maxBrightness = 0.1f; static Range blackHigh(RGBImage img, int x, int y) { int h = img.h(); int y1 = y, y2 = y; while (y1 > 0 && img.getPixel(x, y1-1).getBrightness() < blackHigh_maxBrightness) --y1; while (y2 < h && img.getPixel(x, y2).getBrightness() < blackHigh_maxBrightness) ++y2; ret new Range(y1, y2); }