Added a new blackbox test with extreme shadows and highlights. We do pretty poorly on this, but I've been experimenting with local thresholding algorithms which are a night and day improvement.

Also made the ImageConverter app ignore some kinds of files.

git-svn-id: https://zxing.googlecode.com/svn/trunk@969 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
dswitkin 2009-06-16 18:47:34 +00:00
parent 5c17a1ad71
commit 1da9bd60b3
46 changed files with 71 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 9 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 9 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View file

@ -0,0 +1 @@
9780441014989

Binary file not shown.

After

Width:  |  Height:  |  Size: 9 KiB

View file

@ -0,0 +1 @@
9780441014989

View file

@ -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);
}
}

View file

@ -16,17 +16,18 @@
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;
}