A screen shows a black-and-white grid. Across the room, a device may be able to read it. The information travels in the light that reaches the sensor. If the squares merge in the image, the message can be lost while the grid is still visible.

We isolated one part of the problem by starting where a reader receives an image. We generated QR codes on a computer, altered the images and asked OpenCV to recover the original strings. It had to return every character exactly.

Why the extra squares matter

DENSO WAVE developed the QR code in 1994 for rapid component identification. The large patterns near three corners help the reader locate and orient the symbol. The smaller squares, called modules, make up the data and the structure needed to recognise it.

Error correction adds redundancy. It can recover some damaged data, but a higher level can also require more modules. If image width stays fixed, each module then gets fewer pixels. Finding the symbol and recovering its data are separate problems.

Sources in this section 12

Forty-eight reads

We used 64-, 128- and 256-byte ASCII messages, correction levels M and H, and two seeds per combination. Each image was read in four forms: original, reduced to 180 × 180 pixels, blurred and covered with a white square at the centre. The rerun with OpenCV 4.13.0 matched the earlier record in full.

The decoder got 16 of 16 reads right at 64 bytes, 16 of 16 at 128 and 4 of 16 at 256. That makes 36 exact messages and 12 empty results. Even some original 256-byte images failed. With one of the seeds, blurring allowed an M-level symbol to be read after the original had failed.

Sources in this section 3

What remains to be measured

In this test, the effects of size and image changes varied with the pattern and decoder. The white patch covered 20% of the full image width. That is a geometric measurement, not a percentage of destroyed data. Two seeds per combination are too few to estimate the probability of a successful read.

The images were synthetic. The test applies to these files and this reader. Distance, motion, lighting, real camera performance and end-to-end delivery still need measurement. The demonstration compares the files OpenCV received with the results it recorded.

Sources in this section 3

Try the QR reading test

Choose a case and compare the original image with the one OpenCV received. The results come from the experiment. This page does not use your camera.

Exact read 37 × 37 modules per side

Original image
Original image 360 × 360 px
Analysed image
Analysed image 360 × 360 px
Results by message size
  • 64 bytes16/1616/16
  • 128 bytes16/1616/16
  • 256 bytes4/164/16
Test configuration

Python 3.12.14 · OpenCV 4.13.0 · qrcode 8.2 · NumPy 2.5.5 · Pillow 13.0.0

ASCII · 64 / 128 / 256 bytes · M / H · Seed 0 / 1 · 8 px / modules per side · Reduced to 180 × 180 px · Blur (σ = 2 px) · White square at centre (20% of image width)

Sources and references

  1. DENSO WAVE · History of the QR code
  2. DENSO WAVE · Error correction levels
  3. PyPI · OpenCV distribution used in the experiment

Sources reviewed on .