NaturalHistoryMuseum / pyzbar

Read one-dimensional barcodes and QR codes from Python 2 and 3.
MIT License
718 stars 175 forks source link

QR code detection is not scale invariant #140

Open brennobrenno opened 2 years ago

brennobrenno commented 2 years ago

I think others have mentioned seeing this as well but I have found that detecting QR codes on images is not scale invariant, i.e. the size of the image matters. I am currently trying to detect four QR codes on an image. When the image is kept at its original size (~4000x3000), pyzbar consistently detects about 1 to 3 of the QR codes. If I scale the image prior to detection to a size of ~800x600, pyzbar successfully detects all 4 QR codes.

Has anyone else experienced this? Why would scale matter when trying to detect QR codes on an image?

kdm9 commented 2 years ago

Yes! See https://kdmurray.id.au/post/2022-03-21_decode-qrcodes/

I'd be happy to upstream the auto-rescaling code to this repo if there is interest from the maintainers (edit: tagging @quicklizard99 who I believe is the maintainer of pyzbar based on commit history)