0

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?

1 Answers1

0

This is not a valid QR code, at least not according to the modern spec. It is 25x25, which should be version 2, but lacks an alignment pattern at the bottom right.

Sean Owen
  • 66,182
  • 23
  • 141
  • 173
  • I agree,it is very possible that this code could be obsolete version. I'm going to read qrcodes like this which are placed on some products. Is it possible to force zxing to decode codes not fully compatible to current standards, or I should look for other library? As I said NeoReader can correctly decode this qr, but I need to do it with java PC application. – user3475557 Mar 29 '14 at 17:42
  • No, it is a different format that only appears similar. QR codes made in the last decade should be the new format so I'd be surprised if you encounter codes like this. – Sean Owen Mar 29 '14 at 21:11