QRCode not decoded from bitmap

379 views
Skip to first unread message

venator85

unread,
Jun 30, 2015, 5:25:50 AM6/30/15
to zx...@googlegroups.com
Hi, I'm trying to decode this qrcode:

https://dl.dropboxusercontent.com/u/1493094/qrtest.png

directly from this file using either ZXing version 2.3.0 or 3.2.0 on Android, but I get a NotFoundException. However, if I try to scan the same qrcode using the Barcode scanner app from the phone camera, it is decoded correctly.

Even the ZXing decoding web app can't decode it:
http://zxing.org/w/decode?u=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F1493094%2Fqrtest.png

I also tried using TRY_HARDER but to no avail.
The qrcode has been generated by the ZXing library itself, although with the 2.3.0 version.

Here is the code I'm using:

public static String parseQrCode(Bitmap bitmap) throws Exception {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int[] pixels = new int[width * height];
bitmap.getPixels(pixels, 0, width, 0, 0, width, height);

RGBLuminanceSource luminanceSource = new RGBLuminanceSource(width, height, pixels);
BinaryBitmap bBitmap = new BinaryBitmap(new HybridBinarizer(luminanceSource));

QRCodeReader reader = new QRCodeReader();

EnumMap<DecodeHintType, Object> hints = new EnumMap<DecodeHintType, Object>(DecodeHintType.class);
List<BarcodeFormat> decodeFormats = Arrays.asList(BarcodeFormat.QR_CODE);
hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);

Result result = reader.decode(bBitmap, hints);
return result.getText();
}

The above code is correct since I'm able to decode other qrcodes, it's just this one that I can't decode.

I tried following the decoding process and it stops at com.google.zxing.qrcode.detector.Detector.computeDimension(ResultPoint, ResultPoint, ResultPoint, float), entering the "case 3" of the switch block.

Can someone help me please?
Thanks :)

venator85

unread,
Jun 30, 2015, 5:40:02 AM6/30/15
to zx...@googlegroups.com
Even the command line decoder can't decode it:

$ java -cp core-3.2.0.jar:javase-3.2.0.jar com.google.zxing.client.j2se.CommandLineRunner qrtest.png --try_harder
file:///Users/venator85/qrtest.png: No barcode found

Lachezar Dobrev

unread,
Jun 30, 2015, 6:01:08 AM6/30/15
to venator85, zxing
  ZXing is not a sure-shot scanner.
  Scaling down the image 50% makes it scan.
  There are numerous messages relating to this on the list.
  Typically I would suggest that in case of a failed reading additional attempts are to be made with combinations of down-scaling and various levels of blurring to increase success rate.


--
You received this message because you are subscribed to the Google Groups "zxing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zxing+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages