cozmo / jsQR

A pure javascript QR code reading library. This library takes in raw images and will locate, extract and parse any QR code found within.
https://cozmo.github.io/jsQR/
Apache License 2.0
3.67k stars 606 forks source link

Cannot decode image #141

Open cabdesigns opened 5 years ago

cabdesigns commented 5 years ago

Hi. Thanks for this amazing lib. It's an integral part of a project I'm rolling out, and just on the verge of scaling in production I've noticed the first instance of a QR code not being scanned at all. We use H level (best) precision to generate the QR codes, and the data encoded is a UUID in a text field. In this failing example, the text was 71a08408-7170-4f56-81e7-10b0a4f43444.

I thought it was odd, because the native iPhone camera is still able to recognise the QR code. What gets stranger is if I drop the precision level to Q (high) or below, it can be scanned by this lib.

H level (best) precision - fail best-quality-fail

Q level (high) precision - ok high-quality-ok

It seems to work ok with ZXing.

I'm now concerned as I'm about to be scaling out to 100's of generated QR codes to end users, an unknown percentage of them will be unable to be scanned by this library. I know there's been a few examples already reported, but they don't seem to have made any progress which is worrying.

I would like to help get to the bottom of this, but I'm not sure I currently have the technical know how in this particular field without levelling up. What are my options? Does anyone have any idea? Thanks.

cabdesigns commented 5 years ago

Thankfully dealing with small numbers in production right now, looking like it's affecting around 3% of barcodes generated thus far. We're using https://github.com/soldair/node-qrcode to generate the barcodes.

I'm still at a point where it's manageable to manually regenerate said barcodes for customers, but this will change very soon.

My pragmatic solution to this going forwards will be to test the generated barcode at the point distribution to customer, and keep regenerating with a new UUID until the test passes, before it's actually distributed. It will give some confidence the exact combination of generated barcode and decoding with this library works.

I'm not sure what my longer term solution is (possibly replace out with a wasm barcode reader), but I hope this library is able to improve on some of the reported decoding issues.

lnhrdt commented 5 years ago

Thanks for documenting this issue @cabdesigns -- I've been having the same issue (via the react-qr-reader library which uses jsQR). I believe that JodusNodus/react-qr-reader#118 is related to this issue.