Refactored the MonochromeBitmapSource class hierarchy into LuminanceSource, Binarizer...
[zxing.git] / core / src / com / google / zxing / multi / qrcode / detector / MultiFinderPatternFinder.java
index a12f0ef..c5d8691 100644 (file)
@@ -17,7 +17,7 @@
 package com.google.zxing.multi.qrcode.detector;\r
 \r
 import com.google.zxing.DecodeHintType;\r
-import com.google.zxing.MonochromeBitmapSource;\r
+import com.google.zxing.BinaryBitmap;\r
 import com.google.zxing.ReaderException;\r
 import com.google.zxing.ResultPoint;\r
 import com.google.zxing.common.BitArray;\r
@@ -48,10 +48,13 @@ final class MultiFinderPatternFinder extends FinderPatternFinder {
 \r
   private static final FinderPatternInfo[] EMPTY_RESULT_ARRAY = new FinderPatternInfo[0];\r
 \r
-  // TODO MIN_MODULE_COUNT and MAX_MODULE_COUNT would be great\r
-  // hints to ask the user for since it limits the number of regions to decode\r
-  private static final float MAX_MODULE_COUNT_PER_EDGE = 180; // max. legal count of modules per QR code edge (177)\r
-  private static final float MIN_MODULE_COUNT_PER_EDGE = 9; // min. legal count per modules per QR code edge (11)\r
+  // TODO MIN_MODULE_COUNT and MAX_MODULE_COUNT would be great hints to ask the user for\r
+  // since it limits the number of regions to decode\r
+\r
+  // max. legal count of modules per QR code edge (177)\r
+  private static final float MAX_MODULE_COUNT_PER_EDGE = 180;\r
+  // min. legal count per modules per QR code edge (11)\r
+  private static final float MIN_MODULE_COUNT_PER_EDGE = 9;\r
 \r
   /**\r
    * More or less arbitrary cutoff point for determining if two finder patterns might belong\r
@@ -84,7 +87,7 @@ final class MultiFinderPatternFinder extends FinderPatternFinder {
    *\r
    * @param image image to search\r
    */\r
-  MultiFinderPatternFinder(MonochromeBitmapSource image) {\r
+  MultiFinderPatternFinder(BinaryBitmap image) {\r
     super(image);\r
   }\r
 \r
@@ -124,12 +127,13 @@ final class MultiFinderPatternFinder extends FinderPatternFinder {
      *  - feature similar module sizes\r
      *  - are placed in a distance so the estimated module count is within the QR specification\r
      *  - have similar distance between upper left/right and left top/bottom finder patterns\r
-     *  - form a triangle with 90° angle (checked by comparing top right/bottom left distance with pythagoras)\r
+     *  - form a triangle with 90° angle (checked by comparing top right/bottom left distance\r
+     *    with pythagoras)\r
      *\r
-     * Note: we allow each point to be used for more than one code region: this might seem counterintuitive at first,\r
-     * but the performance penalty is not that big. At this point, we cannot make a good quality decision whether\r
-     * the three finders actually represent a QR code, or are just by chance layouted so it looks like there might\r
-     * be a QR code there.\r
+     * Note: we allow each point to be used for more than one code region: this might seem\r
+     * counterintuitive at first, but the performance penalty is not that big. At this point,\r
+     * we cannot make a good quality decision whether the three finders actually represent\r
+     * a QR code, or are just by chance layouted so it looks like there might be a QR code there.\r
      * So, if the layout seems right, lets have the decoder try to decode.     \r
      */\r
 \r
@@ -184,7 +188,8 @@ final class MultiFinderPatternFinder extends FinderPatternFinder {
 \r
           // Check the sizes\r
           float estimatedModuleCount = ((dA + dB) / p1.getEstimatedModuleSize()) / 2;\r
-          if (estimatedModuleCount > MAX_MODULE_COUNT_PER_EDGE || estimatedModuleCount < MIN_MODULE_COUNT_PER_EDGE) {\r
+          if (estimatedModuleCount > MAX_MODULE_COUNT_PER_EDGE ||\r
+              estimatedModuleCount < MIN_MODULE_COUNT_PER_EDGE) {\r
             continue;\r
           }\r
 \r
@@ -223,7 +228,7 @@ final class MultiFinderPatternFinder extends FinderPatternFinder {
 \r
   public FinderPatternInfo[] findMulti(Hashtable hints) throws ReaderException {\r
     boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);\r
-    MonochromeBitmapSource image = getImage();\r
+    BinaryBitmap image = getImage();\r
     int maxI = image.getHeight();\r
     int maxJ = image.getWidth();\r
     // We are looking for black/white/black/white/black modules in\r