- // As a check, we want to see some white in front of this "start pattern",
- // maybe as wide as the start pattern itself?
- foundStart = row.isRange(Math.max(0, start - 2 * (startRange[1] - start)), start, false);
+ // Make sure there is a quiet zone at least as big as the start pattern before the barcode. If
+ // this check would run off the left edge of the image, do not accept this barcode, as it is
+ // very likely to be a false positive.
+ int quietStart = start - (nextStart - start);
+ if (quietStart >= 0) {
+ foundStart = row.isRange(quietStart, start, false);
+ }