Ring code: two-cut locator, thicker dashes, first-token confirmation, scanner in vote page

This commit is contained in:
2026-08-16 19:40:56 +01:00
parent ca1a73e0bb
commit c96f9b42c1
4 changed files with 20 additions and 17 deletions
+1 -1
View File
@@ -150,6 +150,6 @@ window.debugOne = (trial) => {
}
return { quad: q, cTrue, cEst, radial, cands: out.map((o) => ({ ...o, r: o.r && { token: o.r.token, score: o.r.score, bits: o.r.bits } })) };
};
window.benchReady = true; for (const k of new URLSearchParams(location.search).keys()) globalThis[k] = true;
window.benchReady = true;
</script></head>
<body></body></html>
+3 -1
View File
@@ -39,7 +39,9 @@ function diagnose(img, k, truth, t) {
const T = (x, y) => { const [u, v] = truth(x, y); return [(u + 0.5) * k - 0.5, (v + 0.5) * k - 0.5]; };
const [cx, cy] = T(0, 0), [ex, ey] = T(CENTER, 0), rpx = Math.hypot(ex - cx, ey - cy);
const out = { rpx: +rpx.toFixed(1) };
const cands = locate(img, { max: 60 });
const dbg = { cx, cy, r: rpx, stage: "noblob" };
const cands = locate(img, { max: 60, dbg });
out.loc = dbg.stage;
out.rank = cands.findIndex((c) => Math.hypot(c.cx - cx, c.cy - cy) < 0.3 * rpx);
out.ncand = cands.length;
if (out.rank >= 0) { const r = decodeAt(img, cands[out.rank], {}); out.candOk = !!(r && r.token === t.token); out.candScore = r ? +(+r.score).toFixed(2) : null; }