fix(#55): populate pose3d (getPoseMatrix returned zeros) + rename pose getters - #56
Merged
Merged
Conversation
getPoseMatrix() returned a zero matrix: it reads _patternTrackingInfo.pose3d, which the live tracking path never wrote (the pose flows _pose -> transMat -> trans; pose3d was touched only by the dead computePose). cameraPoseFromPoints now also builds pose3d (the raw 4x4 OpenCV-convention pose) from the same rMat/tvec, so the CV getter reflects the current frame. Rename the two pose getters so the distinction is explicit (they differ in both convention and shape, which the "2" suffix hid): getPoseMatrix -> getPoseMatrixCV (raw OpenCV 4x4 pose) getPoseMatrix2 -> getPoseMatrixGL (right-handed / GL-corrected pose, trans) Hard rename across WebARKitManager + WebARKitTracker (decls, inner impl, outer wrapper). The matching emscripten bindings / controller live in webarkit-testing. Verified: static (1920x1440) and webcam (640x480) examples both track (1000 matches); getPoseMatrixCV() now returns a valid [R|t;0001] (was all zeros). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
kalwalt
added a commit
to webarkit/webarkit-testing
that referenced
this pull request
Jun 20, 2026
Companion to webarkit/WebARKitLib#56. Bump the submodule to the rename+fix commit and rebuild build/ + dist/. - emscripten glue (bindings.cpp, WebARKitJS.{h,cpp}): rename the bound JS API getPoseMatrix -> getPoseMatrixCV, getPoseMatrix2 -> getPoseMatrixGL. - src/WebARKitController.js: getPoseMatrix() -> getPoseMatrixGL() (the GL pose the render path uses), add getPoseMatrixCV(); process_raw calls getPoseMatrixGL(). - examples/worker_threejs.js: drop a stray debug log. Verified: static + webcam examples track; getPoseMatrixCV() returns a real 4x4 pose (was zeros). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
kalwalt
added a commit
to webarkit/webarkit-testing
that referenced
this pull request
Jun 21, 2026
Companion to webarkit/WebARKitLib#56. Bump the submodule to the rename+fix commit and rebuild build/ + dist/. - emscripten glue (bindings.cpp, WebARKitJS.{h,cpp}): rename the bound JS API getPoseMatrix -> getPoseMatrixCV, getPoseMatrix2 -> getPoseMatrixGL. - src/WebARKitController.js: getPoseMatrix() -> getPoseMatrixGL() (the GL pose the render path uses), add getPoseMatrixCV(); process_raw calls getPoseMatrixGL(). - examples/worker_threejs.js: drop a stray debug log. Verified: static + webcam examples track; getPoseMatrixCV() returns a real 4x4 pose (was zeros). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #55.
The bug
getPoseMatrix()(the cv::Mat / 4×4 pose, bound to JS) returned an all-zero matrix. It reads_patternTrackingInfo.pose3d, but the live tracking path never wrotepose3d— the pose flows_pose→transMat→trans(whatgetPoseMatrix2returns), whilepose3dwas touched only by the deadcomputePose/invertPose. Unnoticed because the examples readgetPoseMatrix2, notgetPoseMatrix.The fix
cameraPoseFromPointsnow also buildspose3d(the raw 4×4 OpenCV-convention pose) from the samerMat/tvecit already computes, so the CV getter reflects the current frame. No handedness/scale correction is applied topose3d(that remainsgetPoseMatrixGL'strans).The rename (rides along, agreed in #55)
The
2suffix hid that the two getters differ in both convention and shape:getPoseMatrixgetPoseMatrixCVgetPoseMatrix2trans)getPoseMatrixGLHard rename across
WebARKitManager+WebARKitTracker(decls, inner impl, outer wrapper). The matching emscripten bindings +WebARKitControllerwrapper are in the companion webarkit-testing PR.Testing
Rebuilt (Docker emscripten) and tested both examples:
getPoseMatrixCV()now returns a valid[R|t;0001](e.g. rotation block + translation +[0,0,0,1]); was all zeros before.Follow-up
The now-redundant
computePose/invertPose/computeGLviewMatrix()(no-arg) become removable — tracked in the #50 cleanup.🤖 Generated with Claude Code