Hacker News new | ask | show | jobs
by OtherShrezzing 410 days ago
Reading the QR code spec (or even just the wikipedia page) could help a lot here. A lot of the room on the code is taken up by metadata, rather than output-data. The output data is repeated lots of times across the code (this is why you can have a brand logo right in the middle of the code).

Repairing the metadata parts & iterating over each of the version number should make the overwhelming majority of broken QR codes usable again.

https://en.wikipedia.org/wiki/QR_code#/media/File:QR_Code_St...

4 comments

The data isn’t repeated, it’s using Reed-Solomon-coding and maximum redundancy is only 30% extra data.
A QR code dedicates around 30% to metadata (positioning, timing data, version numbers). There are very few metadata arrangements shared across all QR codes, so you can recover 30% of the code with almost no computation.

The other 70% is dedicated to "data", on which the Reed-Solomon-coding is applied. If your QR code is absolutely stuffed to its limit (about 2kb data), you can still destroy up to 51% of the image before the Reed-Solomon coding will start to fail at 30% redundancy.

Most codes only store a few hundred bytes of data, so you can afford to destroy a lot more before the payload is also destroyed.

I'd expect the minimal-viable QR code for a 100 character URI can be very degraded.

Qr codes have some redundancy but nowhere near "repeated lots of time". Not even twice. More realistically there is 5-30% of redundancy and some very clever math to allow any individual part of data (not neceserily any part of qr code)to be damaged up to certain percentage.
> Reading the QR code spec (or even just the wikipedia page) could help a lot here.

Comprehending what you read could help a lot, too.

The output data generally isn't repeated even a single time in full, let alone "lots of times". That's what error correction keys are for.

The fact that you can stick a logo in the middle doesn't have much to do with anything. I can (and many publishers have!) put a bunch of color pictures in the middle of a book, it doesn't mean the data in the book is repeated.

I'm less interested in the theory and am more interested in the practice. I own a printed copy of the 2015 version of the spec, but don't find the insights I get from it have much to do with its ability to scan as compared to taking my phone out and scanning a QR code does.

In practice, I mostly I find that the corners are the most finicky part. However, that is just my current opinion.

I think if the corners really are more sensitive, it’s because the reader can’t find the QR code and it’s orientation, not because the data is not recoverable. If you would manually enter the pixels into a decoder, the corners shouldn’t be more sensitive than other spaces of the code, I think.