static L ocr_hsplit(RGBImage img, bool[] split) { int w = img.w(), h = img.h(); int x1 = 0, x = 0; new L l; while (x < w) { while (x < w && split[x]) x++; if (x > x1) { l.add(new Rect(x1, 0, x-x1, h)); x1 = x; } while (x < w && !split[x]) x++; if (x > x1) { l.add(new Rect(x1, 0, x-x1, h)); x1 = x; } } ret l; }