Skip to content

qr de-mask: real-geometry gate, density pre-filter, no case-specific 'all masks' (#27) - #31

Merged
dexRand merged 2 commits into
mainfrom
fix/27-qr-demask-gate
Nov 17, 2026
Merged

dexRand merged 2 commits into
mainfrom
fix/27-qr-demask-gate

Conversation

@dexRand

@dexRand dexRand commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Closes #27

What

  • Removed the 9th candidate "XOR of all eight masks" (it was the answer of tj25 masked, other mask combinations never decoded). The 8 standard masks stay (generic: tampered format bits).
  • tj25-masked-qrcode.png back to GAPS: same URL and expected flag, comment says a real mask search is needed.
  • De-masking renders only after real QR geometry: finder module sizes within ±25 %, 90°±10° corner, timing row/column alternating on >= 80 % of modules.
  • Transition-density pre-filter (> 0.35 on images > 40k px returns at once): noise / LSB bit planes measure 0.50, QRs with modules >= 2 px <= 0.28.
  • Detection runs under the analyzer deadline.

Measured: _unmasked on 1920x1080 binary noise 2-3 s -> 0.016 s, 0 renders, 1 zbar call (the direct one). Single masks still recovered at QR versions 1-10 (79/80; the miss was already undecodable on main).

How it was worked (mechanus): arbiter round 1 rejected deepseek's 7c27ddc + 1c963c8 (noise false positives: 9 zbar per bit plane; case-specific candidate); builder fix e172b90; arbiter round 2 rejected for scan time on noise (25-70 s per input image over ~24 bit planes) and a seed-dependent test; fixed in 607ed01. Old qr.py fails 4/9 of test_qr_mask.py.

L1: unit 516 passed, lint clean. L2: this PR's CI.

Residual risk: a QR with modules >= 2 px pasted on a large noisy background skips the de-mask fallback (direct zbar still runs).

🤖 Generated with Claude Code

dexRand added a commit that referenced this pull request Nov 16, 2026
…S); AGENTS: never git stash in worktrees

L2 on PRs #30/#31 and on main: fixtures 33/33, real core 32-33/35, the misses
were client-side 900 s timeouts (dolls.jpg, corrupted_file, try_me.pcap): the
runner analyses ~6x slower than local (11003 s vs 1826 s for the 35 core cases).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dexRand and others added 2 commits November 16, 2026 17:26
… masks"

- remove the 9th "XOR of all eight masks" candidate (answer of one challenge)
- render only after: 3 finders with module sizes within 25 %, near-right-angle
  L (90 +-10 deg), timing pattern alternating on >= 80 % of row 6 / column 6
- finder scan and grid sampling now obey the analyzer deadline
- tj25-masked-qrcode.png back from EXTRA to GAPS (same URL and flag)
- tests: 512x512 RGB and 1920x1080 binary noise -> 0 renders, 1 zbar call;
  deadline test; single wrong mask still decodes

L1: 516 passed in 34.36s. Old qr.py: 3 of the new tests fail.
Noise 1920x1080 binary, detection with expired deadline: 2.9 s before, 0.28 s after.

Refs #27

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…scan

Refs #27

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dexRand
dexRand force-pushed the fix/27-qr-demask-gate branch from 607ed01 to 2832c6a Compare November 16, 2026 16:27
@dexRand
dexRand merged commit a56818a into main Nov 17, 2026
6 checks passed
@dexRand
dexRand deleted the fix/27-qr-demask-gate branch November 17, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

qr de-mask: false positives on noise (9 zbar calls per bit plane) and a case-specific 'all masks' candidate

1 participant