Issue with scanning the QR code present in Indian aadhaar card

200 zobrazení
Preskočiť na prvú neprečítanú správu

Kishan Kumar

neprečítané,
21. 8. 2018, 20:32:1621. 8. 2018
komu: zxing
I am trying to decode the QR code present in the Indian aadhar card using Zxing API for the customer uploaded aadhar image on our website.

I am able to decode the QR code if its big in size and get the complete XML data. However the QR codes which are small in size are not getting decoded as QR codes. They are getting decoded as BarcodeFormat.UPC_E, which is a one dimensional bar code unlike QR code which is two dimensional. So the output for small QR codes is coming something like this 04400621, instead of the expected XML output. This is happening with the online tool https://zxing.org/w/decode.jspx as well.

Some small QR codes are getting decoded by the online tool if we crop just the QR code part of the aadhar but the API fails to decode if we pass the cropped part of the small images.

I am using below API present in com.google.zxing.MultiFormatReader class

Result decode(BinaryBitmap image, Map hints)

Putting breakpoints in MultiFormatReader library, I could see that QRCodeReader is not able to decode the QR code, however MultiFormatOneDReader is able to decode the same.

Hence the small QR codes are getting decoded as BarcodeFormat.UPC_E it seems.

Pasting the code snippet below:


String filePath = "xyz";
File file = new File(filePath);
FileInputStream fileInputStream = new FileInputStream(filePath);
BufferedImage bufferedImage = ImageIO.read(fileInputStream);

LuminanceSource bufferedImageLuminanceSource = new BufferedImageLuminanceSource(bufferedImage);
BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(bufferedImageLuminanceSource));

Map<DecodeHintType, Object> tmpHintsMap = new EnumMap<DecodeHintType, Object>(
DecodeHintType.class);
tmpHintsMap.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
tmpHintsMap.put(DecodeHintType.POSSIBLE_FORMATS,
EnumSet.allOf(BarcodeFormat.class));
tmpHintsMap.put(DecodeHintType.CHARACTER_SET, "ISO-8859-1");
tmpHintsMap.put(DecodeHintType.PURE_BARCODE, Boolean.FALSE);(tried with and without this option)

Result result = new MultiFormatReader().decode(binaryBitmap, tmpHintsMap);

Lachezar Dobrev

neprečítané,
27. 8. 2018, 8:49:2227. 8. 2018
komu: kisha...@gmail.com, zxing
Use only QR_CODE for POSSIBLE_FORMATS.
You're (probably) getting a False-Positive with UPC or Code-39 or
another 1D bar-code type.
> --
> 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.

kishan

neprečítané,
30. 8. 2018, 21:54:5830. 8. 2018
komu: l.do...@gmail.com, zx...@googlegroups.com
Hi Lachezar,

Thanks for your response.
But I had already tried that.
Zxing is not able to decode the small QR codes on passing BarcodeFormat.QR_CODE and is throwing the exception: com.google.zxing.NotFoundException.

The problem is that even the online tool  https://zxing.org/w/decode.jspx  is not able to decode small QR codes.

Thanks,
Kishan.

Lachezar Dobrev

neprečítané,
31. 8. 2018, 8:21:3031. 8. 2018
komu: Kishan Kumar, zxing
If possible can you share one of these? It might be any of a
thousand reasons why the code is not recognised.

Typically though I'd suggest that you try slightly fiddling with the
image: scaling up and down, applying various blurs, applying various
sharpening. ZXing is designed to handle streams of images, and is not
a sure-shot solution when you only have one frame/image to work with.
Instead ZXing works at significantly less than 100% accuracy, but
works fast so that streams can be processes real-time. When there is
no stream, you can simulate one (by applying various modifications to
generate "frames").

kishan

neprečítané,
31. 8. 2018, 21:14:1131. 8. 2018
komu: l.do...@gmail.com, zx...@googlegroups.com
Here is a sample aadhaar image which doesn't work - https://i.stack.imgur.com/1mqTw.jpg.
Its taken from this post where someone had posted the same issue some time back with Indian aadhaar cards. The image of the QR code on an Indian aadhaar card is too small as can be seen from the above image. 
Odpovedať všetkým
Odpovedať autorovi
Poslať ďalej
0 nových správ