Decoding not consistent
See original GitHub issueHi, I have a problem with the decoding of a Qr code image, that i’m passing as a base64 string to the decodeFromImage function, as following
const codeReader = new BrowserQRCodeReader();
codeReader.decodeFromImage(undefined, this.state.qrImage)
.then(
(result) => { this.showSuccessMessage('The QR is valid!'); console.log(result.getResultMetadata()); }
)
.catch(
() => this.showErrorMessage('The QR is unreadable.')
);
When I execute this code multiple times on the same image, the result is not consistent. Sometimes the decoding works and it return the correct result, but other times it throws an exception, and prints in the console the following errors
checksum or format error, trying again... Error
at Decoder.correctErrors (Decoder.js?958e:154)
at Decoder.decodeBitMatrixParser (Decoder.js?958e:125)
at Decoder.decodeBitMatrix (Decoder.js?958e:70)
at QRCodeReader.decode (QRCodeReader.js?680d:64)
at BrowserQRCodeReader.BrowserCodeReader.readerDecode (BrowserCodeReader.js?0615:254)
at BrowserQRCodeReader.BrowserCodeReader.decodeOnce (BrowserCodeReader.js?0615:229)
BrowserCodeReader.js?0615:233 true Error
at Decoder.correctErrors (Decoder.js?958e:154)
at Decoder.decodeBitMatrixParser (Decoder.js?958e:125)
at Decoder.decodeBitMatrix (Decoder.js?958e:70)
at QRCodeReader.decode (QRCodeReader.js?680d:64)
at BrowserQRCodeReader.BrowserCodeReader.readerDecode (BrowserCodeReader.js?0615:254)
at BrowserQRCodeReader.BrowserCodeReader.decodeOnce (BrowserCodeReader.js?0615:229)
I wait for an answer. Thank you
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Encoding/Decoding not working on Dictionary Objects
I'm trying to Encode/Decode an object in order to store it in UserDefaults. My object contains a Dictionary object contining a key, with...
Read more >iphone - NSDateFormatter encoding vs decoding is not consistent ...
When I use this date formatter, it's not giving me back the same date I start with if I got from date ->...
Read more >Consistency of a Recurrent Language Model With Respect to ...
We prove that commonly used incomplete decoding algorithms - greedy search, beam search, top-k sampling, and nucleus sampling - are inconsistent ...
Read more >Decoding not working - main@WSJTX.groups.io
I upgraded my computer to windows 10 and now I can't decode any FT8 signals. The receive status bar is green and at...
Read more >SOLVED: JSON decoding not working - Hacking with Swift
SOLVED: JSON decoding not working ... The issue is that I am running a JSON decoder that is the same as Paul's tutorials...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I couldn’t find any very obvious errors, but I’m a little busy at the moment. I can offeryou an working example you can find in the docs:
source: https://github.com/zxing-js/library/blob/af16fdb2a72b331394dfe22b549703bdfefcae90/docs/examples/qr-image/index.html#L1
(The demo just don’t work online, locally it works fine andyou can use it)
I see you’re using Base64 encoded images and I think that there’s really a bug in the code, that’s not that good yet. You can create your own image element and trigger the
decodeOnce
on image’sonload
event. E.g.:I hope that it helps.
I’m not exactly sure what kind of answer you’re expecting. The Decoder goes through a lot of steps to detect if a given image contains a valid QR-code, it seems that your code fails in the error-correction step. If you want a qualified answer it would help if you could provide the image that causes the actual problem along with information about which version of the library you used, the platform (node, browser, ionic), browser etc.