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
BIN
core/test/data/blackbox/ean13-4/01.jpg
Executable file
After Width: | Height: | Size: 10 KiB |
1
core/test/data/blackbox/ean13-4/01.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/02.jpg
Executable file
After Width: | Height: | Size: 9.4 KiB |
1
core/test/data/blackbox/ean13-4/02.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/03.jpg
Executable file
After Width: | Height: | Size: 9.6 KiB |
1
core/test/data/blackbox/ean13-4/03.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/04.jpg
Executable file
After Width: | Height: | Size: 9 KiB |
1
core/test/data/blackbox/ean13-4/04.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/05.jpg
Executable file
After Width: | Height: | Size: 8.4 KiB |
1
core/test/data/blackbox/ean13-4/05.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/06.jpg
Executable file
After Width: | Height: | Size: 9.4 KiB |
1
core/test/data/blackbox/ean13-4/06.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/07.jpg
Executable file
After Width: | Height: | Size: 9 KiB |
1
core/test/data/blackbox/ean13-4/07.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/08.jpg
Executable file
After Width: | Height: | Size: 9.1 KiB |
1
core/test/data/blackbox/ean13-4/08.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/09.jpg
Executable file
After Width: | Height: | Size: 7.9 KiB |
1
core/test/data/blackbox/ean13-4/09.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/10.jpg
Executable file
After Width: | Height: | Size: 7.6 KiB |
1
core/test/data/blackbox/ean13-4/10.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/11.jpg
Executable file
After Width: | Height: | Size: 8.3 KiB |
1
core/test/data/blackbox/ean13-4/11.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/12.jpg
Executable file
After Width: | Height: | Size: 8.1 KiB |
1
core/test/data/blackbox/ean13-4/12.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/13.jpg
Executable file
After Width: | Height: | Size: 8.7 KiB |
1
core/test/data/blackbox/ean13-4/13.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/14.jpg
Executable file
After Width: | Height: | Size: 6.8 KiB |
1
core/test/data/blackbox/ean13-4/14.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/15.jpg
Executable file
After Width: | Height: | Size: 6.3 KiB |
1
core/test/data/blackbox/ean13-4/15.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/16.jpg
Executable file
After Width: | Height: | Size: 6.7 KiB |
1
core/test/data/blackbox/ean13-4/16.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/17.jpg
Executable file
After Width: | Height: | Size: 8 KiB |
1
core/test/data/blackbox/ean13-4/17.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/18.jpg
Executable file
After Width: | Height: | Size: 8.3 KiB |
1
core/test/data/blackbox/ean13-4/18.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/19.jpg
Executable file
After Width: | Height: | Size: 9.6 KiB |
1
core/test/data/blackbox/ean13-4/19.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/20.jpg
Executable file
After Width: | Height: | Size: 9.7 KiB |
1
core/test/data/blackbox/ean13-4/20.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/21.jpg
Executable file
After Width: | Height: | Size: 8.4 KiB |
1
core/test/data/blackbox/ean13-4/21.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
BIN
core/test/data/blackbox/ean13-4/22.jpg
Executable file
After Width: | Height: | Size: 9 KiB |
1
core/test/data/blackbox/ean13-4/22.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9780441014989
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -16,17 +16,18 @@
|
||||||
|
|
||||||
package com.google.zxing.client.j2se;
|
package com.google.zxing.client.j2se;
|
||||||
|
|
||||||
import com.google.zxing.MonochromeBitmapSource;
|
|
||||||
import com.google.zxing.BlackPointEstimationMethod;
|
import com.google.zxing.BlackPointEstimationMethod;
|
||||||
|
import com.google.zxing.MonochromeBitmapSource;
|
||||||
import com.google.zxing.ReaderException;
|
import com.google.zxing.ReaderException;
|
||||||
import com.google.zxing.common.BitArray;
|
import com.google.zxing.common.BitArray;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility application for evaluating the effectiveness of the BlackPointEstimator used by
|
* 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
|
* 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.exists()) {
|
||||||
if (inputFile.isDirectory()) {
|
if (inputFile.isDirectory()) {
|
||||||
for (File input : inputFile.listFiles()) {
|
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());
|
convertImage(input.toURI());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -158,7 +169,7 @@ public final class ImageConverter {
|
||||||
name = name.substring(0, dotpos);
|
name = name.substring(0, dotpos);
|
||||||
}
|
}
|
||||||
String suffix = (sMethod == BlackPointEstimationMethod.ROW_SAMPLING) ? "row" : "2d";
|
String suffix = (sMethod == BlackPointEstimationMethod.ROW_SAMPLING) ? "row" : "2d";
|
||||||
result = new File(name + "_converted_" + suffix + '.' + FORMAT);
|
result = new File(name + '.' + suffix + '.' + FORMAT);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|