Photograph a damaged barcode. Get back a clean one.
Rust core · QR · Aztec · DataMatrix · PDF417
Folded, smudged, scuffed, badly printed — or with a logo pasted over the middle. barclean recovers the data, rebuilds the symbol that was actually there, and saves it as a PNG.
Reed–Solomon corrects errors — unknown position, unknown value — at half the rate it corrects erasures, damage whose position is known. A logo is damage whose position is, in principle, perfectly knowable. No shipping decoder exploits this, because they all binarize before detection: by the time anything knows where a module sits, the greyscale and colour that would have revealed the logo are gone, and the covered modules arrive as confident, wrong bits.
barclean carries the luminance and chroma all the way into the sampler. A partly-decoded symbol proves — algebraically, no heuristics — which of its codewords were wrong. QR's interleaving scatters a contiguous logo across every block, so surviving blocks report exactly which modules the occlusion covered. Declare those as erasures, retry at double the correction power, and blocks start coming back. Every rescued block sharpens the map and rescues the next one.
Measured at module level, not asserted — ECC-H with 30% of the symbol covered is a dead symbol to a plain decoder (4 of 11 blocks); barclean recovers all eleven:
| ECC | occlusion | plain decode | barclean |
|---|---|---|---|
| M | 13–16% | 3/4 blocks | 4/4 — full recovery |
| Q | 19–25% | 2–7/8 blocks | 8/8 — full recovery |
| H | 26–30% | 4–9/11 blocks | 11/11 — full recovery |
| H | 31–32% | 2/11 blocks | 8/11 (partial) |
Two properties are non-negotiable, tested at every ECC level and occlusion step: it never loses ground — the floor is always plain decoding's result — and clean symbols are untouched.
The output is rebuilt from the corrected codewords, not by re-encoding the payload. Two encoders given identical text routinely emit different symbols; a "cleaned" code that scans to the right string but is structurally different is a re-creation that won't look like the code you photographed. So the tests compare module by module against the original. All four symbologies restore bit-exactly.
Point it at a code. It freezes on a successful scan and shows what it did:
A logo's footprint shows up as a solid yellow-and-red patch, so "this was reconstructed" is
something you can see rather than take on faith. Save writes a black-and-white PNG
to Pictures/barclean with the quiet zone the symbology needs; there's a button per
physical camera, and inverted and mirrored codes are handled automatically.