Added a new blackbox test with extreme shadows and highlights. We do pretty poorly...
authordswitkin <dswitkin@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Tue, 16 Jun 2009 18:47:34 +0000 (18:47 +0000)
committerdswitkin <dswitkin@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Tue, 16 Jun 2009 18:47:34 +0000 (18:47 +0000)
Also made the ImageConverter app ignore some kinds of files.

git-svn-id: http://zxing.googlecode.com/svn/trunk@969 59b500cc-1b3d-0410-9834-0bbf25fbcc57

46 files changed:
core/test/data/blackbox/ean13-4/01.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/01.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/02.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/02.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/03.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/03.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/04.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/04.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/05.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/05.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/06.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/06.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/07.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/07.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/08.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/08.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/09.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/09.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/10.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/10.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/11.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/11.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/12.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/12.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/13.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/13.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/14.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/14.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/15.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/15.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/16.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/16.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/17.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/17.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/18.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/18.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/19.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/19.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/20.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/20.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/21.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/21.txt [new file with mode: 0644]
core/test/data/blackbox/ean13-4/22.jpg [new file with mode: 0755]
core/test/data/blackbox/ean13-4/22.txt [new file with mode: 0644]
core/test/src/com/google/zxing/oned/EAN13BlackBox4TestCase.java [new file with mode: 0644]
javase/src/com/google/zxing/client/j2se/ImageConverter.java

diff --git a/core/test/data/blackbox/ean13-4/01.jpg b/core/test/data/blackbox/ean13-4/01.jpg
new file mode 100755 (executable)
index 0000000..2dd2985
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/01.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/01.txt b/core/test/data/blackbox/ean13-4/01.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/02.jpg b/core/test/data/blackbox/ean13-4/02.jpg
new file mode 100755 (executable)
index 0000000..2138d36
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/02.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/02.txt b/core/test/data/blackbox/ean13-4/02.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/03.jpg b/core/test/data/blackbox/ean13-4/03.jpg
new file mode 100755 (executable)
index 0000000..686b281
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/03.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/03.txt b/core/test/data/blackbox/ean13-4/03.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/04.jpg b/core/test/data/blackbox/ean13-4/04.jpg
new file mode 100755 (executable)
index 0000000..54e679c
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/04.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/04.txt b/core/test/data/blackbox/ean13-4/04.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/05.jpg b/core/test/data/blackbox/ean13-4/05.jpg
new file mode 100755 (executable)
index 0000000..87b3224
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/05.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/05.txt b/core/test/data/blackbox/ean13-4/05.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/06.jpg b/core/test/data/blackbox/ean13-4/06.jpg
new file mode 100755 (executable)
index 0000000..1514c91
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/06.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/06.txt b/core/test/data/blackbox/ean13-4/06.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/07.jpg b/core/test/data/blackbox/ean13-4/07.jpg
new file mode 100755 (executable)
index 0000000..a0ba153
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/07.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/07.txt b/core/test/data/blackbox/ean13-4/07.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/08.jpg b/core/test/data/blackbox/ean13-4/08.jpg
new file mode 100755 (executable)
index 0000000..6333dcd
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/08.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/08.txt b/core/test/data/blackbox/ean13-4/08.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/09.jpg b/core/test/data/blackbox/ean13-4/09.jpg
new file mode 100755 (executable)
index 0000000..b27b3e8
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/09.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/09.txt b/core/test/data/blackbox/ean13-4/09.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/10.jpg b/core/test/data/blackbox/ean13-4/10.jpg
new file mode 100755 (executable)
index 0000000..c53bbf0
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/10.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/10.txt b/core/test/data/blackbox/ean13-4/10.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/11.jpg b/core/test/data/blackbox/ean13-4/11.jpg
new file mode 100755 (executable)
index 0000000..eb128de
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/11.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/11.txt b/core/test/data/blackbox/ean13-4/11.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/12.jpg b/core/test/data/blackbox/ean13-4/12.jpg
new file mode 100755 (executable)
index 0000000..7aef2f4
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/12.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/12.txt b/core/test/data/blackbox/ean13-4/12.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/13.jpg b/core/test/data/blackbox/ean13-4/13.jpg
new file mode 100755 (executable)
index 0000000..a7bc1a9
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/13.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/13.txt b/core/test/data/blackbox/ean13-4/13.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/14.jpg b/core/test/data/blackbox/ean13-4/14.jpg
new file mode 100755 (executable)
index 0000000..21e2da3
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/14.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/14.txt b/core/test/data/blackbox/ean13-4/14.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/15.jpg b/core/test/data/blackbox/ean13-4/15.jpg
new file mode 100755 (executable)
index 0000000..3284234
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/15.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/15.txt b/core/test/data/blackbox/ean13-4/15.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/16.jpg b/core/test/data/blackbox/ean13-4/16.jpg
new file mode 100755 (executable)
index 0000000..32ec283
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/16.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/16.txt b/core/test/data/blackbox/ean13-4/16.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/17.jpg b/core/test/data/blackbox/ean13-4/17.jpg
new file mode 100755 (executable)
index 0000000..b4e8585
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/17.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/17.txt b/core/test/data/blackbox/ean13-4/17.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/18.jpg b/core/test/data/blackbox/ean13-4/18.jpg
new file mode 100755 (executable)
index 0000000..bfe20f4
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/18.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/18.txt b/core/test/data/blackbox/ean13-4/18.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/19.jpg b/core/test/data/blackbox/ean13-4/19.jpg
new file mode 100755 (executable)
index 0000000..e44484a
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/19.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/19.txt b/core/test/data/blackbox/ean13-4/19.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/20.jpg b/core/test/data/blackbox/ean13-4/20.jpg
new file mode 100755 (executable)
index 0000000..14370df
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/20.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/20.txt b/core/test/data/blackbox/ean13-4/20.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/21.jpg b/core/test/data/blackbox/ean13-4/21.jpg
new file mode 100755 (executable)
index 0000000..d7faf71
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/21.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/21.txt b/core/test/data/blackbox/ean13-4/21.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/data/blackbox/ean13-4/22.jpg b/core/test/data/blackbox/ean13-4/22.jpg
new file mode 100755 (executable)
index 0000000..8558118
Binary files /dev/null and b/core/test/data/blackbox/ean13-4/22.jpg differ
diff --git a/core/test/data/blackbox/ean13-4/22.txt b/core/test/data/blackbox/ean13-4/22.txt
new file mode 100644 (file)
index 0000000..33d6b99
--- /dev/null
@@ -0,0 +1 @@
+9780441014989
\ No newline at end of file
diff --git a/core/test/src/com/google/zxing/oned/EAN13BlackBox4TestCase.java b/core/test/src/com/google/zxing/oned/EAN13BlackBox4TestCase.java
new file mode 100644 (file)
index 0000000..206efb5
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2009 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.zxing.oned;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.MultiFormatReader;
+import com.google.zxing.common.AbstractBlackBoxTestCase;
+
+/**
+ * A very difficult set of images taken with extreme shadows and highlights.
+ * @author dswitkin@google.com (Daniel Switkin)
+ */
+public final class EAN13BlackBox4TestCase extends AbstractBlackBoxTestCase {
+
+  public EAN13BlackBox4TestCase() {
+    super("test/data/blackbox/ean13-4", new MultiFormatReader(), BarcodeFormat.EAN_13);
+    addTest(6, 12, 0.0f);
+    addTest(7, 13, 180.0f);
+  }
+
+}
index 5b5a5a4..313708a 100644 (file)
 
 package com.google.zxing.client.j2se;
 
-import com.google.zxing.MonochromeBitmapSource;
 import com.google.zxing.BlackPointEstimationMethod;
+import com.google.zxing.MonochromeBitmapSource;
 import com.google.zxing.ReaderException;
 import com.google.zxing.common.BitArray;
 
-import javax.imageio.ImageIO;
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.IOException;
 import java.net.URI;
 
+import javax.imageio.ImageIO;
+
 /**
  * Utility application for evaluating the effectiveness of the BlackPointEstimator used by
  * MonochromeBitmapSource. Given a set of images on the command line, it converts each to a
@@ -65,6 +66,16 @@ public final class ImageConverter {
       if (inputFile.exists()) {
         if (inputFile.isDirectory()) {
           for (File input : inputFile.listFiles()) {
+            String filename = input.getName().toLowerCase();
+            // Skip hidden files and text files (the latter is found in the blackbox tests).
+            if (filename.startsWith(".") || filename.endsWith(".txt")) {
+              continue;
+            }
+            // Skip the results of dumping the black point.
+            if (filename.contains(".mono.png") || filename.contains(".row.png") ||
+                filename.contains(".2d.png")) {
+              continue;
+            }
             convertImage(input.toURI());
           }
         } else {
@@ -158,7 +169,7 @@ public final class ImageConverter {
         name = name.substring(0, dotpos);
       }
       String suffix = (sMethod == BlackPointEstimationMethod.ROW_SAMPLING) ? "row" : "2d";
-      result = new File(name + "_converted_" + suffix + '.' + FORMAT);
+      result = new File(name + '.' + suffix + '.' + FORMAT);
     }
     return result;
   }