mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 19:57:27 -08:00
(Thanks to John White) Make UPC/EAN decoder less picky about white space bordering 1D code
git-svn-id: https://zxing.googlecode.com/svn/trunk@557 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
f14d648ee0
commit
966c5a8e97
|
@ -94,7 +94,7 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements
|
|||
nextStart = startRange[1];
|
||||
// As a check, we want to see some white in front of this "start pattern",
|
||||
// maybe as wide as the start pattern itself?
|
||||
foundStart = row.isRange(Math.max(0, start - 2 * (startRange[1] - start)), start, false);
|
||||
foundStart = row.isRange(Math.max(0, start - (3 * (startRange[1] - start)) / 2), start, false);
|
||||
}
|
||||
return startRange;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements
|
|||
|
||||
// Check for whitespace after the pattern
|
||||
int end = endRange[1];
|
||||
if (!row.isRange(end, Math.min(row.getSize(), end + 2 * (end - endRange[0])), false)) {
|
||||
if (!row.isRange(end, Math.min(row.getSize(), end + (3 * (end - endRange[0])) / 2), false)) {
|
||||
throw new ReaderException("Pattern not followed by whitespace");
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public final class FalsePositivesBlackBoxTestCase extends AbstractNegativeBlackB
|
|||
super(new File("test/data/blackbox/falsepositives"));
|
||||
addTest(1, 0.0f);
|
||||
addTest(1, 90.0f);
|
||||
addTest(1, 180.0f);
|
||||
addTest(2, 180.0f);
|
||||
addTest(0, 270.0f);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ public final class EAN13BlackBox1TestCase extends AbstractBlackBoxTestCase {
|
|||
|
||||
public EAN13BlackBox1TestCase() {
|
||||
super(new File("test/data/blackbox/ean13-1"), new MultiFormatReader(), BarcodeFormat.EAN_13);
|
||||
addTest(26, 29, 0.0f);
|
||||
addTest(24, 29, 180.0f);
|
||||
addTest(27, 29, 0.0f);
|
||||
addTest(25, 29, 180.0f);
|
||||
}
|
||||
|
||||
}
|
|
@ -29,8 +29,8 @@ public final class UPCEBlackBox2TestCase extends AbstractBlackBoxTestCase {
|
|||
|
||||
public UPCEBlackBox2TestCase() {
|
||||
super(new File("test/data/blackbox/upce-2"), new MultiFormatReader(), BarcodeFormat.UPC_E);
|
||||
addTest(17, 28, 0.0f);
|
||||
addTest(19, 28, 180.0f);
|
||||
addTest(24, 34, 0.0f);
|
||||
addTest(26, 34, 180.0f);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue