za3k / qr-backup

Paper backup of files using QR codes
Other
128 stars 12 forks source link

Self-check sometimes fails due to zbarimg unreliability #9

Open za3k opened 3 years ago

za3k commented 3 years ago

zbarimg is failing and the self-check of the pdf frequently fails. Get a repro case and report this to zbarimg. Generally see if zbarimg/zbarcam can be improved (in terms of read % and size)--QR resolution is a bit low right now.

za3k commented 3 years ago

Reported as https://github.com/mchehab/zbar/issues/182

misaki-web commented 3 years ago

I noticed this problem using qr-backup. I added a comment on the zbar issue. It seems that moving the missed QR code just 1 pixel in one direction solves the issue, so the problem may be with exact alignment of several QR codes on the same page.

A workaround may be to avoid positioning the QR codes on a perfect grid, but move each code 1 pixel in a different direction alternately. It would not be visually noticeable.

za3k commented 3 years ago

It's better to fix the QR scanner for everyone, rather than introduce a qr-backup specific workaround for a problem in the QR scanner.

I'd like to understand what's happening better. If you can demonstrate a qr-backup patch that removes grid-alignment and consistently works, please do so. It would definitely help diagnose the root cause.

Show the command/patch you're using to adjust things one pixel. It's always best to let other people directly reproduce things themselves in bug reports.

misaki-web commented 3 years ago

It's better to fix the QR scanner for everyone, rather than introduce a qr-backup specific workaround for a problem in the QR scanner.

Yes, I agree. My workaround is just an idea that may solve temporarily the issue (in my few manual tests, it seems to always solve the issue) in case the root issue is not found easily or quickly by zbar devs.

I'd like to understand what's happening better. If you can demonstrate a qr-backup patch that removes grid-alignment and consistently works, please do so. It would definitely help diagnose the root cause.

I'm not sure I'll have time for now, but I'll keep it in mind. However, an even better workaround may be to split the page with imagemagick (for example) before scanning QR codes, so if the page has 16 QR codes, split it in 16 individual PNG images, then scan each one separately. It may even help to find alternatives to zbar because some QR code readers don't seem to scan all possible codes on an image but only one.

Show the command/patch you're using to adjust things one pixel. It's always best to let other people directly reproduce things themselves in bug reports.

Actually, I made some tests by editing the image directly with GIMP. It was just a few preliminary tests to check if the issue seemed to be related to QR code positioning.

za3k commented 2 years ago

Improved by specifying -density 600 in the restore process, but still very finicky.

za3k commented 2 years ago

Now that I'm doing a PDF->tif conversion as a workaround, whole pages have started failing sometimes