Adjust formatting on last change. Simplify GridSampler
[zxing.git] / core / src / com / google / zxing / qrcode / detector / Detector.java
index b9d7f2c..b0eba53 100644 (file)
@@ -160,7 +160,7 @@ public class Detector {
       sourceBottomRightX = sourceBottomRightY = dimMinusThree;
     }
 
-    PerspectiveTransform transform = PerspectiveTransform.quadrilateralToQuadrilateral(
+    return PerspectiveTransform.quadrilateralToQuadrilateral(
         3.5f,
         3.5f,
         dimMinusThree,
@@ -177,8 +177,6 @@ public class Detector {
         bottomRightY,
         bottomLeft.getX(),
         bottomLeft.getY());
-
-    return transform;
   }
 
   private static BitMatrix sampleGrid(BitMatrix image,
@@ -186,7 +184,7 @@ public class Detector {
                                       int dimension) throws NotFoundException {
 
     GridSampler sampler = GridSampler.getInstance();
-    return sampler.sampleGrid(image, dimension, transform);
+    return sampler.sampleGrid(image, dimension, dimension, transform);
   }
 
   /**
@@ -376,6 +374,9 @@ public class Detector {
 
     int alignmentAreaTopY = Math.max(0, estAlignmentY - allowance);
     int alignmentAreaBottomY = Math.min(image.getHeight() - 1, estAlignmentY + allowance);
+    if (alignmentAreaBottomY - alignmentAreaTopY < overallEstModuleSize * 3) {
+      throw NotFoundException.getNotFoundInstance();
+    }
 
     AlignmentPatternFinder alignmentFinder =
         new AlignmentPatternFinder(