Ring scanner: seed the crop read, try three candidates
This commit is contained in:
@@ -27,6 +27,10 @@ const pipes = {
|
||||
const s = (scanners[key] ||= window.makeRingScanner({ accumulate: false }));
|
||||
return s.scan(canvas, canvas.width, canvas.height, t.now ?? undefined);
|
||||
},
|
||||
crop: (canvas, t, key) => {
|
||||
const s = (scanners[key] ||= window.makeRingScanner({ gate: t.now != null, crop: +key.slice(4) }));
|
||||
return s.scan(canvas, canvas.width, canvas.height, t.now ?? undefined);
|
||||
},
|
||||
scan: (canvas, t, key) => {
|
||||
// a lone still has no previous token to agree with
|
||||
const s = (scanners[key] ||= window.makeRingScanner(t.now == null ? { gate: false } : {}));
|
||||
@@ -135,7 +139,7 @@ window.runFar = async (cfg) => {
|
||||
for (const name of cfg.pipes) {
|
||||
for (const key of Object.keys(scanners)) delete scanners[key];
|
||||
const t0 = performance.now();
|
||||
const d = pipes[name](f.canvas, t, name);
|
||||
const d = (pipes[name] || pipes[name.slice(0, 4)])(f.canvas, t, name);
|
||||
const ms = performance.now() - t0;
|
||||
res[name] = { ok: t.nocode ? !d.token : d.token === t.token, token: d.token || null, ms: +ms.toFixed(1), found: d.found, score: d.score == null ? null : +(+d.score).toFixed(2) };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user