Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(meta) Adjusting the settings to obtain a higher storage density #26

Closed
arcanemachine opened this issue Mar 18, 2022 · 10 comments
Closed
Labels
enhancement New feature or request

Comments

@arcanemachine
Copy link

I wanted to open this issue as a more open-ended alternative to the pull request I made (#25). I definitely think that a higher storage density (on paper) can be achieved than the defaults currently provide, which would save paper and storage space.

Version 40 does not appear to work to any reasonable degress when printed. However, after doing some experimentation, I have found that QR version 25 with error correction level "H" can be used to fit a 4x3 grid of codes onto a page which, when printed, can be scanned reliably by both my phone (which is a mid-range Android from 2018) and a scanner, and can reliably reproduce a valid backup without any issue.

Please give it a try and let me know what you think.

@za3k
Copy link
Owner

za3k commented Mar 18, 2022

I suspect android code scanning works better than zbarimg and a computer. Can you test with zbarimg too please?

I'll take a look soon too, in case you don't have a webcam.

@arcanemachine
Copy link
Author

Yeah, I ended up buying an older secondhand scanner to verify this. It scans a little crooked but zbar had no issues scanning dozens of codes (not conclusive results for sure, but I think it's a good start).

@za3k
Copy link
Owner

za3k commented Mar 18, 2022

Oh, shoot. I meant to say can you test with zbarcam too. Scanners are generally excellent quality--I expect you might be able to go up to version 30 or 40 with one. No need to buy anything if you don't have one, please! I expect to have time sometime in the next week to work on qr-backup.

@arcanemachine
Copy link
Author

arcanemachine commented Mar 19, 2022

I gave it a shot, but zbarcam crashes on me literally every time. Heres the traceback from attempting to restore README.md on default settings from your latest commit:

Hold up QR codes to the webcam in any order.
Traceback (most recent call last):
  File "/home/user/code/python/qr-backup/./qr-backup", line 1000, in <module>
    main_restore(args[1:])
  File "/home/user/code/python/qr-backup/./qr-backup", line 935, in main_restore
    assert b"\n" not in read_code
AssertionError

The good news is that removing line 935 makes it work just fine. (I guess an issue should be opened about this, but I'll abstain for now since I've been harassing you so much.)

So to answer the question: yes, qr code version 25 works great with error correction level 'H". After monkeying around with the settings, I've been able to fit a 4x3 grid onto a single page.

The webcam I used is pretty decent: It's a Logitech B525 that has a resolution of 1280x720.

EDIT: This is a little out of scope, but I also wanted to mention one other thing: When zbarcam opens up, it happens to cover up my terminal. It took me a while to notice that the terminal was updating with the info from zbarcam as it scanned the codes. Perhaps there could be some sort of instructions before the window pops up, or perhaps the window could automatically close when all the codes are entered, etc. Just food for thought.

@za3k
Copy link
Owner

za3k commented Mar 19, 2022 via email

@za3k za3k added the enhancement New feature or request label Mar 21, 2022
@za3k
Copy link
Owner

za3k commented Mar 21, 2022

Please also open an issue for zbarcam covering your terminal, and include a screenshot.

@za3k
Copy link
Owner

za3k commented Mar 21, 2022

So for my built-in webcam in my laptop, this was very finicky. I had to try for a few solid minutes to scan two codes--I wouldn't trust this system.

I think it's okay to aim at the lowest denominator in the market in terms of scanning, but it would be nice to have a sheet automatically printed that could tell you what options to pass if you want to pack things in (hold it up and see what level code your webcam can easily scan)

@za3k
Copy link
Owner

za3k commented Mar 25, 2022

#29 opened for zbarcam covering the terminal. I both don't have a working zbarcam preview, AND I use a tiling window manager so it doesn't get covered. So if you want to provide a screenshot of what it looks like for normal people that might be nice.

@za3k
Copy link
Owner

za3k commented Apr 12, 2022

Changing the scale has a significant impact. With my about-to-be-released margin changes, the numbers I get are:

  • --scale 8 gives 4.97KB/page
  • --scale 7 gives 4.97KB/page (0% improvement)
  • --scale 6 gives 7.76KB/page (56% improvement)
  • --scale 5 gives 11.18KB/page (125% improvement)
  • --scale 4 gives 19.88KB/page (300% improvement)

Currently my webcam can read 6-8 easily, and struggles a little on 5. I will change the default to 5, and continue researching a 'test sheet' which has a grid of qr codes at different scales and module sizes.

@za3k
Copy link
Owner

za3k commented Apr 12, 2022

OK, I invented a test page. If anyone want to test, please post the output, together with what you used (for me, the T460s built-in webcam).

The QR code numbers are: density, correction level, version, scale. So you want the code with the highest density.

Use: zbarcam -Sdisable -Sqrcode.enable --raw | tee test-results.log
Sorting will give you the most aggressive plausible density, though it may be difficult to read in practice, definitely test a full sheet.

test.pdf

I'd be interested in what results other people get with this test page,

za3k added a commit that referenced this issue Apr 12, 2022
Suggested in #26

This results in 125% (about 2X) improvement in data storage density. Scale of 6 is easier to read on my camera--I'll collect info from others and consider changing the value further.
@za3k za3k closed this as completed Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants