za3k / qr-backup

Paper backup of files using QR codes
Other
114 stars 11 forks source link

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

Closed arcanemachine closed 1 year ago

arcanemachine commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

Please open an issue

On 2022-03-18 11:00 pm, arcanemachine wrote:

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

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. -- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. Triage notifications on the go with GitHub Mobile for iOS [3] or Android [4]. You are receiving this because you commented.Message ID: ***@***.***> Links: ------ [1] https://github.com/za3k/qr-backup/issues/26#issuecomment-1072949485 [2] https://github.com/notifications/unsubscribe-auth/AAFRLUVZNL3XWVYQRQIGEVTVAVUQFANCNFSM5RAQ7RVQ [3] https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 [4] https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub
za3k commented 2 years ago

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

za3k commented 2 years ago

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 commented 2 years ago

https://github.com/za3k/qr-backup/issues/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 commented 2 years ago

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

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 commented 2 years ago

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,