}
String resultString = result.toString();
+
+ if (resultString.length() == 0) {
+ // Almost surely a false positive
+ throw new ReaderException("Empty barcode found; assuming a false positive");
+ }
+
float left = (float) (startPatternInfo[1] + startPatternInfo[0]) / 2.0f;
float right = (float) (nextStart + lastStart) / 2.0f;
return new Result(
if (extendedMode) {
resultString = decodeExtended(resultString);
}
+
+ if (resultString.length() == 0) {
+ // Almost surely a false positive
+ throw new ReaderException("Empty barcode found; assuming a false positive");
+ }
+
float left = (float) (start[1] + start[0]) / 2.0f;
float right = (float) (nextStart + lastStart) / 2.0f;
return new Result(
super(new File("test/data/blackbox/falsepositives"), new MultiFormatReader(), null);
}
+ @Override
public void testBlackBox() throws IOException {
File[] imageFiles = getImageFiles();
int falsePositives = 0;
// Try all four rotations, since many of the test images don't have a notion of up, and we
// want to be as robust as possible.
BufferedImage image = ImageIO.read(testImage);
+ if (image == null) {
+ throw new IOException("Could not read image: " + testImage);
+ }
for (int x = 0; x < 4; x++) {
if (!checkForFalsePositives(image, x * 90.0f)) {
falsePositives++;