fix: report raw detections alongside scene-filtered ones so a discarded crest is visible
This commit is contained in:
+12
-3
@@ -5,10 +5,19 @@ export function createDetector() {
|
|||||||
return new AR.Detector({ dictionaryName: 'ARUCO_4X4_1000', maxHammingDistance: 0 });
|
return new AR.Detector({ dictionaryName: 'ARUCO_4X4_1000', maxHammingDistance: 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns the markers usable for solving: present in the scene, sane geometry.
|
||||||
|
* The returned array also carries diagnostics so the HUD can distinguish
|
||||||
|
* "nothing detected" from "detected but not in the scene" — the latter looks
|
||||||
|
* identical on screen but means the scene never loaded, or the crest belongs to
|
||||||
|
* a different layout. knownIds may be null/empty; then nothing is solvable and
|
||||||
|
* rawIds tells you what the camera actually saw.
|
||||||
|
*/
|
||||||
export function detectMarkers(detector, imageData, knownIds) {
|
export function detectMarkers(detector, imageData, knownIds) {
|
||||||
const markers = detector.detect(imageData);
|
const raw = detector.detect(imageData).filter(m => quadArea(m.corners) > 100);
|
||||||
// keep only markers that exist in the scene, with sane geometry
|
const usable = (knownIds && knownIds.size) ? raw.filter(m => knownIds.has(m.id)) : [];
|
||||||
return markers.filter(m => knownIds.has(m.id) && quadArea(m.corners) > 100);
|
usable.rawCount = raw.length;
|
||||||
|
usable.rawIds = raw.map(m => m.id);
|
||||||
|
return usable;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function quadArea(c) {
|
export function quadArea(c) {
|
||||||
|
|||||||
Reference in New Issue
Block a user