Filter unconfirmed QR code finder patterns before testing triangles to avoid long-running analysis. Closes #1567

This commit is contained in:
Sean Owen 2022-11-01 14:43:07 -05:00
parent bdc7c26526
commit 110ef9e8f2
4 changed files with 10 additions and 3 deletions

View file

@ -26,6 +26,7 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -621,6 +622,12 @@ public class FinderPatternFinder {
throw NotFoundException.getNotFoundInstance();
}
for (Iterator<FinderPattern> it = possibleCenters.iterator(); it.hasNext();) {
if (it.next().getCount() < CENTER_QUORUM) {
it.remove();
}
}
possibleCenters.sort(moduleComparator);
double distortion = Double.MAX_VALUE;

View file

@ -32,7 +32,7 @@ public final class MaxiCodeBlackBox1TestCase extends AbstractBlackBoxTestCase {
public MaxiCodeBlackBox1TestCase() {
super("src/test/resources/blackbox/maxicode-1", new MultiFormatReader(), BarcodeFormat.MAXICODE);
addHint(DecodeHintType.PURE_BARCODE);
addTest(1, 1, 0.0f);
addTest(7, 7, 0.0f);
}
}

View file

@ -27,7 +27,7 @@ public final class Maxicode1TestCase extends AbstractBlackBoxTestCase {
public Maxicode1TestCase() {
super("src/test/resources/blackbox/maxicode-1", new MultiFormatReader(), BarcodeFormat.MAXICODE);
addTest(6, 6, 0.0f);
addTest(7, 7, 0.0f);
}
}

View file

@ -28,7 +28,7 @@ public final class QRCodeBlackBox2TestCase extends AbstractBlackBoxTestCase {
public QRCodeBlackBox2TestCase() {
super("src/test/resources/blackbox/qrcode-2", new MultiFormatReader(), BarcodeFormat.QR_CODE);
addTest(31, 31, 0.0f);
addTest(30, 30, 90.0f);
addTest(29, 29, 90.0f);
addTest(30, 30, 180.0f);
addTest(30, 30, 270.0f);
}