Tightened a condition to reduce accidentally detecting the alignment pattern as a...
[zxing.git] / core / src / com / google / zxing / qrcode / detector / FinderPatternFinder.java
index 2714eef..63592bf 100755 (executable)
@@ -33,7 +33,7 @@ import java.util.Vector;
  *\r
  * <p>This class is not thread-safe and should not be reused.</p>\r
  *\r
- * @author srowen@google.com (Sean Owen)\r
+ * @author Sean Owen\r
  */\r
 final class FinderPatternFinder {\r
 \r
@@ -423,10 +423,10 @@ final class FinderPatternFinder {
           // How far down can we skip before resuming looking for the next\r
           // pattern? In the worst case, only the difference between the\r
           // difference in the x / y coordinates of the two centers.\r
-          // This is the case where you find top left first. Draw it out.\r
+          // This is the case where you find top left last.\r
           hasSkipped = true;\r
           return (int) (Math.abs(firstConfirmedCenter.getX() - center.getX()) -\r
-              Math.abs(firstConfirmedCenter.getY() - center.getY()));\r
+              Math.abs(firstConfirmedCenter.getY() - center.getY())) / 2;\r
         }\r
       }\r
     }\r
@@ -462,7 +462,7 @@ final class FinderPatternFinder {
       FinderPattern pattern = (FinderPattern) possibleCenters.elementAt(i);\r
       totalDeviation += Math.abs(pattern.getEstimatedModuleSize() - average);\r
     }\r
-    return totalDeviation <= 0.15f * totalModuleSize;\r
+    return totalDeviation <= 0.05f * totalModuleSize;\r
   }\r
 \r
   /**\r
@@ -484,7 +484,7 @@ final class FinderPatternFinder {
 \r
     if (size < 3) {\r
       // Couldn't find enough finder patterns\r
-      throw new ReaderException("Could not find three finder patterns");\r
+      throw ReaderException.getInstance();\r
     }\r
 \r
     if (size > 3) {\r