bardecoder icon indicating copy to clipboard operation
bardecoder copied to clipboard

Unable to read 200x200 QR Code with empty center space

Open oceanlewis opened this issue 5 years ago • 5 comments

Seems that QR Codes that have an empty center space to them are not readable by bardecoder.

test-small-inline

It's readable on my phone, so at least it's valid to whatever library that is using. Let me know if you need more information from me :)

Edit: It also seems that larger QR Codes with the same empty center space also fail to be read.

oceanlewis avatar Sep 19 '19 21:09 oceanlewis

It seems that it's related to the number of characters in the QR Code. Here's two images that differ by one character. The first is unreadable by bardecoder, the second is. Both are readable by my phone.

The unreadable one: unreadable

The readable one: readable

oceanlewis avatar Sep 19 '19 21:09 oceanlewis

Hey, thanks for the report. I'm a little bit busy the coming days but I'll have a look next week.

piderman314 avatar Sep 22 '19 15:09 piderman314

It looks like this is coming from decode::qr::correct. eq is being passed to solve() as an empty list, and is triggering solve() to return None due to num_eq == 0. Digging further...

locs is also an empty list. This is apparently because in every place find_locs() checks, it gets a check value mismatch. The check values are all nonzero integers: 179, 32, 8, 136, 108, 243, 50, 43, etc.

What does this mean? I have no idea. I don't know enough about QR code decoding to understand how this all works, and there are very few comments in this section of code. But hopefully the extra information will help track it down by someone more knowledgeable than me.

@davidarmstronglewis Do you mind if I include a unit test which includes your failing barcode? Don't know if you got it from somewhere or generated it yourself, but I figured I'd better ask before I go including it in the codebase on my fork.

KyleMaas avatar Apr 25 '20 20:04 KyleMaas

@KyleMaas Please do! I'm not working on the project where I ran into this issue anymore, but I'd be happy to see this work continue to evolve and improve 🙂

oceanlewis avatar Apr 25 '20 21:04 oceanlewis

wechat2 emm, this kind of QR code also can not be detected:

result: [Err(QRError { msg: "Could not calculate error distances" })]

chenyukang avatar Nov 24 '21 11:11 chenyukang