Add static image example with Teblid tracker (#30) - #32
Merged
Conversation
Adds a static-image AR example that feeds a fixed JPEG into the Teblid tracker instead of a webcam stream, enabling testing without camera access. - threejs_teblid_static_image_ES6_example.html: hidden <img> input, no initCamera - threejs_static_image_worker_ES6.js: full-resolution RGBA processing - data/pinball-demo.jpg: test image containing the marker Fixes needed to make tracking work (worker_threejs.js left unchanged): - decode the marker JPEG to RGBA pixels via a 2D canvas (initTrackerGray does not decode JPEG; raw file bytes produced a garbage reference marker) - process the frame at full resolution so it matches the tracker's frame buffer - send a blank warmup frame before the real image to avoid a first-frame perspectiveTransform crash in the tracker The marker tracks successfully; the 3D sphere is not yet visible due to a pre-existing pose-convention issue tracked separately in #31. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced May 29, 2026
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.
Summary
Implements #30: a static-image AR example that feeds a fixed JPEG into the Teblid tracker instead of a webcam stream, so the tracker can be exercised without camera access (useful for debugging and CI). Structure mirrors
threejs_ES6_example.html, reusingworker_threejs.jsand the existingdata/pinball.jpgmarker unchanged.The marker tracks successfully. The 3D sphere is not yet visible due to a pre-existing pose-convention issue, filed separately as #31 (out of scope here).
What's included
examples/threejs_teblid_static_image_ES6_example.html<img>input (noinitCamera);loadevent starts trackingexamples/threejs_static_image_worker_ES6.jsexamples/data/pinball-demo.jpgdocs/design-static-image-teblid-example.mdworker_threejs.js,data/pinball.jpg, and the CSS/JS assets are reused without modification.Bugs found & fixed (to make tracking actually work)
All fixes live in the new client worker —
worker_threejs.jsis untouched:initTrackerGray()treats its buffer as raw pixels (no JPEG decode), so the ~764 KB compressed file was read as a 13 MB RGBA reference → garbage marker, matching always failed. Now decoded to RGBA pixels via a plain 2D canvas (noGrayScale/WebGL class, per request).videoWidth × videoHeight, but the original threejs worker sent a downscaled frame. Now processes the image at full resolution to match.perspectiveTransformcrash. When a marker is detected on frame 0 (_frameCount == 0), the tracker callsGetTrackedFeaturesWarped()before the tracked-feature set is populated → OpenCV assert (scn+1 == m.cols). Worked around with a blank warmup frame; frames are fed via worker ping-pong (throttles heavy full-res processing) and stop once tracked.Review checklist
worker_threejs.jsanddata/pinball.jpgare genuinely unchangeddocs/(vs. PR description only)pinball-demo.jpgis the intended test assetRisk assessment
Test plan
examples/over HTTP and openthreejs_teblid_static_image_ES6_example.htmlMarker tracked ! Num. matches : NKnown follow-up
matrixGL_RHthrows). Fix lives in the WebARKitLib submodule + WASM rebuild.🤖 Generated with Claude Code