Reputation: 2902
It is possible to overlay an image over a QRCode and have it scanned because there is some redondancy.
But How can I compute the maximum numbers of modules I can obscure and which redondancy I still have ?
I see most people just tweaking their codes with photoshop and trying with their reader : I want to generate QRCode on the fly and add some arbirtray image so this kind of manual tweaking cannot work for me.
Upvotes: 3
Views: 2350
Reputation: 66886
From Wikipedia, the four error correction levels enable the following approximate levels of error correction recovery:
Level L (Low) 7% of codewords can be restored.
Level M (Medium) 15% of codewords can be restored.
Level Q (Quartile) 25% of codewords can be restored.
Level H (High) 30% of codewords can be restored.
For the exact numbers, you would need to refer to the QR code spec (ISO 18004).
It's a little more complicated than this. For example, the EC figures don't apply to the finder patterns in the corners. While you can distort them a bit, there's no hard and fast limit on exactly how much.
Likewise, there are regions of the QR code data not covered by EC, because the contain the EC level and version info themselves. These are regions just around the top-right and bottom-left code. They have a different EC scheme and have some redundancy but would be a bi hard to explain exactly how many you can corrupt.
Finally, remember that for any module covered by your logo there's about a 50% chance (well, depends on your logo) that the logo's light/darkness matches the underlying module. So it's not introducing an error. So, the exact number of codewords you corrupt by your logo depends on the logo and underlying QR code modules!
Your best bet is to use level H error correction. Then create a number of test QR codes with progressively more distortion. Use a library like zxing with a debugger to detect the point where your samples start to fail due to EC limits. Then back off to maybe 75% of that size.
This ought to be enough cushion for almost all practical situations.
Upvotes: 7