From e677e270fdcb80886abfe47ca4b257f3d70caa03 Mon Sep 17 00:00:00 2001 From: Showdown76py Date: Sun, 16 Aug 2026 20:00:08 +0100 Subject: [PATCH] Ring scanner: portrait streams, keep tightest blob --- static/js/ringcode.js | 2 +- static/js/ringscan.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/static/js/ringcode.js b/static/js/ringcode.js index 5179227..4bf1ab3 100644 --- a/static/js/ringcode.js +++ b/static/js/ringcode.js @@ -376,7 +376,7 @@ export function locate(img, opts = {}) { } g = g2; w = w2; h = h2; } - // same disc seen at two levels: keep the finer fit + // same disc seen at two levels or cuts: keep the tightest blob, the others may have swallowed a ring raw.sort((p, q) => q.area - p.area); const cands = []; for (const c of raw) { diff --git a/static/js/ringscan.js b/static/js/ringscan.js index 70e8cf6..0aa72ef 100644 --- a/static/js/ringscan.js +++ b/static/js/ringscan.js @@ -37,7 +37,8 @@ export function makeRingScanner(opts = {}) { if (d) return d; } track = null; - const k = Math.min(1, WIDE / sw); + // phones held upright hand over a 1080x1920 stream + const k = Math.min(1, WIDE / Math.max(sw, sh)); wide.width = Math.round(sw * k); wide.height = Math.round(sh * k); // plain bilinear at 3x reduction skips pixels and keeps the noise wctx.imageSmoothingQuality = "high";