static int[] ocr_leftProfile(BWImage img, double stopAtRatio) { int stopAt = iround(img.getWidth()*stopAtRatio), h = img.getHeight(); int[] out = new int[h]; for y to w: { int x = 0; while (x <= stopAt && img.getPixel(x, y) > 0.5f) ++x; out[y] = x; } ret out; }