mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
Filter unconfirmed QR code finder patterns before testing triangles to avoid long-running analysis. Closes #1567
This commit is contained in:
parent
bdc7c26526
commit
110ef9e8f2
|
@ -26,6 +26,7 @@ import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -621,6 +622,12 @@ public class FinderPatternFinder {
|
||||||
throw NotFoundException.getNotFoundInstance();
|
throw NotFoundException.getNotFoundInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (Iterator<FinderPattern> it = possibleCenters.iterator(); it.hasNext();) {
|
||||||
|
if (it.next().getCount() < CENTER_QUORUM) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
possibleCenters.sort(moduleComparator);
|
possibleCenters.sort(moduleComparator);
|
||||||
|
|
||||||
double distortion = Double.MAX_VALUE;
|
double distortion = Double.MAX_VALUE;
|
||||||
|
|
|
@ -32,7 +32,7 @@ public final class MaxiCodeBlackBox1TestCase extends AbstractBlackBoxTestCase {
|
||||||
public MaxiCodeBlackBox1TestCase() {
|
public MaxiCodeBlackBox1TestCase() {
|
||||||
super("src/test/resources/blackbox/maxicode-1", new MultiFormatReader(), BarcodeFormat.MAXICODE);
|
super("src/test/resources/blackbox/maxicode-1", new MultiFormatReader(), BarcodeFormat.MAXICODE);
|
||||||
addHint(DecodeHintType.PURE_BARCODE);
|
addHint(DecodeHintType.PURE_BARCODE);
|
||||||
addTest(1, 1, 0.0f);
|
addTest(7, 7, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public final class Maxicode1TestCase extends AbstractBlackBoxTestCase {
|
||||||
|
|
||||||
public Maxicode1TestCase() {
|
public Maxicode1TestCase() {
|
||||||
super("src/test/resources/blackbox/maxicode-1", new MultiFormatReader(), BarcodeFormat.MAXICODE);
|
super("src/test/resources/blackbox/maxicode-1", new MultiFormatReader(), BarcodeFormat.MAXICODE);
|
||||||
addTest(6, 6, 0.0f);
|
addTest(7, 7, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public final class QRCodeBlackBox2TestCase extends AbstractBlackBoxTestCase {
|
||||||
public QRCodeBlackBox2TestCase() {
|
public QRCodeBlackBox2TestCase() {
|
||||||
super("src/test/resources/blackbox/qrcode-2", new MultiFormatReader(), BarcodeFormat.QR_CODE);
|
super("src/test/resources/blackbox/qrcode-2", new MultiFormatReader(), BarcodeFormat.QR_CODE);
|
||||||
addTest(31, 31, 0.0f);
|
addTest(31, 31, 0.0f);
|
||||||
addTest(30, 30, 90.0f);
|
addTest(29, 29, 90.0f);
|
||||||
addTest(30, 30, 180.0f);
|
addTest(30, 30, 180.0f);
|
||||||
addTest(30, 30, 270.0f);
|
addTest(30, 30, 270.0f);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue