🔍 QR Scanner Lab

A from-scratch QR decoder with every stage instrumented and drawn over the captured image: finder landmarks, sampling grid, mask & format info, Reed–Solomon codeword units, and the decoded payload. ← andr00.com

Base: Overlays:
How the decoder works
  1. Binarize — adaptive threshold over an integral image turns the frame into dark/light pixels.
  2. Finder patterns — scanlines hunt the 1:1:3:1:1 ratio, cross-checked vertically; the best three candidates become the TL/TR/BL landmarks.
  3. Geometry — module size is measured along the lines between finder centers (rotation-proof), the version inferred, the alignment pattern locked, and a projective transform fitted.
  4. Sampling — every module is sampled through the transform (5-probe majority vote).
  5. Format info — both 15-bit BCH copies are read and matched against all 32 valid codes → EC level + mask id.
  6. Codeword mapping — the mask is XORed off and bits are read in the zigzag order, grouping every 8 data modules into one codeword (the outlined units) and de-interleaving them into blocks.
  7. Reed–Solomon — each block runs syndrome → Berlekamp–Massey → Chien → Forney; repaired codewords glow red.
  8. Payload — the corrected bitstream parses into numeric / alphanumeric / byte / kanji segments.

Versions 1–10, all EC levels, rotated and mirrored codes supported. Everything is decoded locally — no library, no network.