feat: keep the previous pose when the worker rejects one, and expose the rejection reason
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* becomes a 3D world point (from scene.json anchors, same anchorWorldMatrix
|
||||
* convention as v2), and ONE solvePnP recovers the camera pose directly:
|
||||
* - stability scales with marker spread instead of degrading into fusion tuning
|
||||
* - the wall crest makes the point set non-coplanar => planar ambiguity gone
|
||||
* - a non-coplanar crest (one standing vertical) removes planar ambiguity
|
||||
* - single visible marker still works (IPPE init + iterative refine w/ prior)
|
||||
*
|
||||
* The solve itself runs in cv-worker.js. OpenCV.js embeds ~8MB of WASM as a
|
||||
@@ -95,6 +95,7 @@ export class CvBoardSolver {
|
||||
this.lastPose = null; // newest smoothed pose from the worker
|
||||
this.lastReproj = 0;
|
||||
this.lastCount = 0;
|
||||
this.lastReject = ''; // why the worker last refused a pose (HUD)
|
||||
this._v = new THREE.Vector3();
|
||||
this._m4 = new THREE.Matrix4();
|
||||
this._q = new THREE.Quaternion();
|
||||
@@ -126,7 +127,10 @@ export class CvBoardSolver {
|
||||
|
||||
_onPose(m) {
|
||||
this.inFlight = false;
|
||||
if (!m.ok) return;
|
||||
// a rejected pose leaves the previous one in place: better a slightly stale
|
||||
// camera than a mirrored one that throws every ghost across the table
|
||||
if (!m.ok) { this.lastReject = m.why || 'fail'; return; }
|
||||
this.lastReject = '';
|
||||
this.lastReproj = m.reproj || 0;
|
||||
this.lastCount = m.n / 4;
|
||||
this._m4.set(
|
||||
|
||||
Reference in New Issue
Block a user