"Try harder" now examines a lot more lines in the image
authorsrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Fri, 14 Mar 2008 20:54:12 +0000 (20:54 +0000)
committersrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Fri, 14 Mar 2008 20:54:12 +0000 (20:54 +0000)
git-svn-id: http://zxing.googlecode.com/svn/trunk@282 59b500cc-1b3d-0410-9834-0bbf25fbcc57

core/src/com/google/zxing/oned/AbstractOneDReader.java

index 7deb852..e5effa6 100644 (file)
@@ -84,12 +84,17 @@ public abstract class AbstractOneDReader implements OneDReader {
     // rowStep is bigger as the image is taller, but is always at least 1. We've somewhat arbitrarily decided
     // that moving up and down by about 1/16 of the image is pretty good.
     int middle = height >> 1;
-    int rowStep = Math.max(1, height >> 4);
+    int rowStep;
+    if (tryHarder) {
+      rowStep = 2; // Look at every other line if "trying harder"
+    } else {
+      rowStep = Math.max(1, height >> 4);
+    }
     int maxLines;
-    if (barcodesToSkip > 0) {
+    if (tryHarder || barcodesToSkip > 0) {
       maxLines = height; // Look at the whole image; looking for more than one barcode
     } else {
-      maxLines = tryHarder ? 15 : 7; // If "trying harder", examine more lines
+      maxLines = 7;
     }
     for (int x = 0; x < maxLines; x++) {