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