I Punched a Hole in a QR Code. It Still Scans
? Get the next deep dive: https://techwithnikola.com/newsletter
I send one email every few months, diving deep into topics and areas that I can't cover in a youtube video. Occasionally, I also send emails about engineering leadership, tools that I use, etc.
Why can a QR code with 75 missing black squares still scan, while another fails after only 18 are removed? It isn’t only about how much damage a QR code can survive. It matters which parts are damaged—and whether the scanner can reach the error-correction stage at all.
Sources and further reading:
- QR Code development history: https://www.qrcode.com/en/history/
- QR Code structure and quiet zone: https://www.qrcode.com/en/howto/code.html
- ZXing QR decoder: https://github.com/zxing/zxing/tree/master/core/src/main/java/com/google/zxing/qrcode
- OpenCV perspective transforms: https://docs.opencv.org/4.x/da/d54/group__imgproc__transform.html
If you enjoy visual, mechanism-first explanations of computer science and software engineering, subscribe for more.
Timecodes
0:00 The damage paradox
1:10 From camera pixels to a grid
8:01 From QR modules to codewords
11:23 Reed–Solomon error correction
19:20 Correction limits and interleaving
24:14 Format information
26:04 The complete decoding pipeline
27:13 Scanning an unfinished QR code