fix(scanner): stop the badge glyph dot from stealing the centre ellipse - #1306
Merged
bmc08gt merged 1 commit intoAug 22, 2026
Merged
Conversation
…ipse A code is located by its centre badge, but the badge is a disc with the Flipcash "F" knocked out of it, and the glyph's round dot is itself a near-perfect ellipse sitting ~0.08D from the badge centre. Once the code is drawn large enough in frame, that dot clears the candidate filters and the two ellipses end up in the same prune bucket. The prune dropped the wrong one. Its rule was "discard this candidate if a nearby one is at most twice its area", which is order-dependent and, for a big/small pair, always discards the big one. The badge disappeared and the scan was left searching from the dot, which yields one finder point instead of nine. Measured on a 1920x1080 frame: a code occupying 540px decodes, 756 and 972 do not. Prune only true near-duplicates -- the same physical circle fitted twice from the inner and outer edge of its stroke, which are comparable in area. A much smaller neighbour is a different feature nested inside, so keep both and let the search decide; the badge sorts first and still hits on the first iteration, so the happy path is unchanged. The sweep harness masked this by substituting a plain white oval for the badge. It now renders the real artwork, which is what put the dot in frame in the first place.
This was referenced Aug 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1303 — it needs the sweep harness that PR adds. Retarget to
code/cashonce #1303 lands.The bug
A code is located by its centre badge. The badge is a disc with the Flipcash "F" knocked out of it (
ic_logo_round_white,fillType="evenOdd"), and the glyph's round dot is itself a near-perfect ellipse sitting ~0.08·D from the badge centre.Once the code is drawn large enough in frame, that dot clears the candidate filters and lands in the same 50px prune bucket as the badge. The prune then drops the wrong one:
It only scans forward (
j > i), so for a big/small pair it always discards the big one. The badge disappears and the search runs from the dot, which yields one finder point instead of nine.Trace from the instrumented detector on a 1920x1080 frame:
size=25at an offset down-left of centre is the glyph dot, not the badge.This is a hard failure band, not a slowdown: hold the phone close enough and the code will not decode until you back off. It is very likely the real story behind the reports of "occasionally-slow" scanning.
The fix
Prune only true near-duplicates — the same physical circle fitted twice from the inner and outer edge of its stroke, which are comparable in area. A much smaller neighbour is a different feature nested inside, so keep both and let the search decide.
The badge sorts first and still hits on iteration 0, so the happy path is unchanged — the trace confirms the dot is never even searched.
Harness change
The sweep substituted a plain white oval for the badge, which has no glyph and therefore no dot. That is exactly why it never caught this. It now renders the real artwork.
Measured on an S25 Ultra, real
ic_logo_round_whitein a 1920x1080 frame:Full sweep with the real badge: 18/18 decoded, stride parity intact.
iOS
The same defect is live on iOS —
CodeScanner/CodeScanner/src/scanner.cpp:721carries the identical line andCodeViewfills the badge withFillStyle(eoFill: true). Being ported alongside a wider scanner-parity pass.