brarcher / loyalty-card-locker

Stores your barcode-based store/loyalty cards on your phone
GNU General Public License v3.0
172 stars 29 forks source link

Improve the quiet zone for barcodes #195

Closed denilsonsa closed 6 years ago

denilsonsa commented 6 years ago

What's the quiet zone? It's the blank area around a barcode: https://www.google.com/search?q=quiet+zone+barcode&tbm=isch

How large should it be? A quick google search says “The general sizing rule for a minimal quiet zone (QZ) is 10 times the width of the narrowest bar” for 1D barcodes, “This is a region 4X wide […] 4X means width of 4 modules” for QR code, “a white space of 2 times the size of a module” for Datamatrix…

Does it really matter? I don't know. Some scanners might be better than others. But I noticed that the following 1D barcode (from #194) does not have enough quiet zone:

1D barcode without quiet zone

Is it a real problem? I don't know.

Did I try to scan it? Not recently.

What to do? I'd suggest keeping this in the backlog, but with low priority for now. If someone else is complaining about unreadable barcodes, then this issue should be tackled.

brarcher commented 6 years ago

I looked at some barcodes on packages, and I see what you mean. Namely, extra whitespace on the sides of the barcodes.

This should be simple enough to resolve by adding some extra space between the barcode and the end of the screen.

brarcher commented 6 years ago

I've added a change which would add some quite space before and after the barcode. The amount added was a guess. For some phones it will probably be right, but for large phones it may be wrong. If there are reports where the barcodes cannot be scanned, I may need to figure out how to better calculate the needed quite space.

Thanks for mentioning this. I never considered there might be an issue.

lgasp commented 6 years ago

The barcode scanner in a shop i use stopped working properly starting from v0.19 , maybe because of lack of quiet zone in new versions. I tried to revert to an old version from fdroid but installation failed, don't know why.

brarcher commented 6 years ago

Thanks for the report. The adding of the quiet space will be in the next release, which will come out when I finish one more piece I'm working on.

As for not being able to downgrade, the database did not change recently so I'm not sure why the downgrade would fail.

lgasp commented 6 years ago

I installed version 0.21 and the issue is solved, the barcode is read in the same place where it didn't work in version 0.20.

The quiet is there doing its job!

Thank you

Thab

brarcher commented 6 years ago

Yay! Thanks for confirming!

If someone finds a barcode which no longer scans, and find that the quite space is insufficient, please re-open.