Vote page: camera zooms itself onto a small ring it sees but can't read, until the zoom button is touched
This commit is contained in:
@@ -23,9 +23,12 @@ export function makeRingScanner(opts = {}) {
|
||||
const seed = { cx: (t.cx - x0) * k - 0.5, cy: (t.cy - y0) * k - 0.5, r: t.unit * CENTER * k, A: t.A && t.A.map((v) => v * k) };
|
||||
const d = reader.read(grayOf(cctx.getImageData(0, 0, crop.width, crop.height)), now, seed);
|
||||
if (!d.cand) return null;
|
||||
// where the code sits in the frame and how big, as fractions: lets the camera zoom in on a small one
|
||||
const ux = x0 + (d.cand.cx + 0.5) / k, uy = y0 + (d.cand.cy + 0.5) / k, unit = d.cand.r / CENTER / k;
|
||||
d.where = { x: ux / sw, y: uy / sh, d: (2 * DISC * unit) / Math.min(sw, sh) };
|
||||
// only a blob with a sync ring keeps the crop alive, anything else goes back to the whole frame
|
||||
if (!d.token && !d.soft) { track = null; return d; }
|
||||
track = { cx: x0 + (d.cand.cx + 0.5) / k, cy: y0 + (d.cand.cy + 0.5) / k, unit: d.cand.r / CENTER / k, A: d.cand.A.map((v) => v / k), at: now };
|
||||
track = { cx: ux, cy: uy, unit, A: d.cand.A.map((v) => v / k), at: now };
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user