I'm working on Java application for decoding qrcodes like following: qrcode1 I always got com.google.zxing.NotFoundException when calling reader's decode method in following code.
public String decode(File img) throws QRCodeException {
Result result;
BinaryBitmap binaryBitmap;
try (FileInputStream fis = new FileInputStream(img)) {
Map<DecodeHintType, Object> decodeHints = new HashMap<>();
decodeHints.put(DecodeHintType.TRY_HARDER, TRUE);
decodeHints.put(DecodeHintType.ASSUME_GS1, TRUE);
binaryBitmap = new BinaryBitmap(new HybridBinarizer(new BufferedImageLuminanceSource(ImageIO.read(fis))));
MultiFormatReader reader = new MultiFormatReader();
result = reader.decode(binaryBitmap, decodeHints);
BarcodeFormat barcodeFormat = result.getBarcodeFormat();
System.out.println("QR Code : " + result.getText());
return result.getText();
} catch (Exception ex) {
ex.printStackTrace();
throw new QRCodeException();
}
}
I tried also check these codes with Android apps. Most of them don't recognize these qrcodes. There is only one app which gives right result NeoReader.
Do you have any idea how to get zxing to get work with these qrcodes?