Debug Flipping Fixes
This commit is contained in:
@@ -22,12 +22,16 @@
|
||||
/* global AR, CV */
|
||||
|
||||
export const DETECT_PRESETS = {
|
||||
// maxHamming: reject markers the detector had to bit-correct. Logging showed
|
||||
// every phantom id (998, 692, ...) had hamming==1 while real crests read at 0,
|
||||
// so hamming==0 kills phantoms with ~no cost. Bump to 1 only if a real marker
|
||||
// is genuinely hard to read (dim/worn print).
|
||||
// crisp, fast — good light, marker fills a decent part of frame
|
||||
strict: { minSizeRatio: 0.04, epsilon: 0.05, threshKernel: 2, threshBias: 7, warp: 49, multiScale: false },
|
||||
strict: { minSizeRatio: 0.04, epsilon: 0.05, threshKernel: 2, threshBias: 7, warp: 49, multiScale: false, maxHamming: 0 },
|
||||
// the sensible default for an exhibit — noticeably more forgiving
|
||||
forgiving:{ minSizeRatio: 0.015, epsilon: 0.06, threshKernel: 2, threshBias: 7, warp: 49, multiScale: true },
|
||||
forgiving:{ minSizeRatio: 0.015, epsilon: 0.06, threshKernel: 2, threshBias: 7, warp: 49, multiScale: true, maxHamming: 0 },
|
||||
// last resort — distant/dim/awkward; costs more CPU
|
||||
greedy: { minSizeRatio: 0.008, epsilon: 0.08, threshKernel: 3, threshBias: 9, warp: 49, multiScale: true },
|
||||
greedy: { minSizeRatio: 0.008, epsilon: 0.08, threshKernel: 3, threshBias: 9, warp: 49, multiScale: true, maxHamming: 1 },
|
||||
};
|
||||
|
||||
export class TunedDetector {
|
||||
@@ -91,6 +95,12 @@ export class TunedDetector {
|
||||
try { extra = this._passDownscaled(imageData, dims.width, dims.height); } catch (_) { extra = []; }
|
||||
for (const m of extra) if (!seen.has(m.id)) markers.push(m);
|
||||
}
|
||||
|
||||
// Reject bit-corrected reads: a hamming distance above the preset threshold
|
||||
// means the detector guessed at the code -> phantom ids. Real crests read at 0.
|
||||
const maxH = this.preset.maxHamming ?? 0;
|
||||
markers = markers.filter((m) => (m.hammingDistance ?? 0) <= maxH);
|
||||
|
||||
return markers;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user