-
Notifications
You must be signed in to change notification settings - Fork 0
Integrate ARToolKit WASM detector with ImageBitmap→OffscreenCanvas→detector pipeline #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate ARToolKit WASM detector with ImageBitmap→OffscreenCanvas→detector pipeline #4
Conversation
) * scaffold ARToolKit plugin with initial setup and basic functionality * feat(worker): add detection worker stub and wire to plugin * fix(plugin): restore ArtoolkitPlugin class and integrate worker lifecycle * scaffold ARToolKit plugin with initial setup and basic functionality - missed plugin.js! * feat(worker): enhance cross-platform support for worker lifecycle and messaging * feat(plugin): enhance ImageBitmap handling and add browser smoke test * feat(plugin): enhance marker tracking configuration and sweep logic
Co-authored-by: kalwalt <[email protected]>
… in browser and Node
- Add loadMarker message handling in worker with ARController simulation - Add plugin.loadMarker() method with Promise-based API - Add logging for detectionResult and loadMarkerResult messages - Create examples/simple-marker with index.html, patt.hiro, and README - Support both browser and Node worker environments Co-authored-by: kalwalt <[email protected]>
…ing node:worker_threads Only attempt to import node:worker_threads when in Node.js environment (typeof self === 'undefined'). In browser environments, skip the import entirely to avoid CORS policy violations. Co-authored-by: kalwalt <[email protected]>
…d UI and event handling
…ved initialization handling
…in ARToolKit integration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR transforms the ARToolKit plugin from a simple stub into a fully functional AR marker detection system. It integrates ARToolKit WASM in a Web Worker, implements pattern marker loading, and adds comprehensive documentation and examples.
Key changes:
- Integrates ARToolKit5-js WASM library for real marker detection in the worker
- Implements pattern marker loading API with promise-based request/response handling
- Adds comprehensive documentation with setup instructions and examples
- Creates a complete working example demonstrating webcam-based marker detection
Reviewed Changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/worker/worker.js | Transforms worker stub into full ARToolKit integration with marker loading, filtering, and frame processing |
| src/worker/artoolkit/loader.js | Adds ARToolKit WASM loader stub for future binary integration |
| src/worker/artoolkit/README.md | Documents ARToolKit WASM setup options and fallback behavior |
| src/plugin.js | Adds loadMarker API with promise-based worker communication and getMarker event forwarding |
| package.json | Adds @ar-js-org/artoolkit5-js dependency |
| package-lock.json | Locks dependency versions including artoolkit5-js and its transitive dependencies |
| examples/simple-marker/script.js | Creates comprehensive webcam-based marker detection example |
| examples/simple-marker/index.html | Provides interactive demo UI for marker loading |
| examples/simple-marker/data/patt.hiro | Adds Hiro pattern file for marker detection |
| examples/simple-marker/data/camera_para.dat | Adds ARToolKit camera calibration data |
| examples/simple-marker/README.md | Documents example setup and usage instructions |
| README.md | Expands documentation with features, API reference, architecture, and troubleshooting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- The context hint should be willReadFrequently: true since getImageData is called on line 291 as a fallback. The 'false' value may hurt performance when ImageData is actually needed. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…se is valid HTML5, uppercase is the conventional standard. Co-authored-by: Copilot <[email protected]>
… from the catch block, preventing proper error propagation. Remove the return statement from the finally block Co-authored-by: Copilot <[email protected]>
…ements and usage instructions
Implements real-time marker detection pipeline in Web Worker using ARToolKit WASM. Transfers ImageBitmap from main thread, processes via OffscreenCanvas, runs detection, emits structured results.
Worker Pipeline
New:
src/worker/artoolkit/loader.js{ id, confidence, poseMatrix, corners }per detectionModified:
src/worker/worker.jsKey behaviors:
Plugin Updates
Modified:
src/plugin.jsLive Example
New:
examples/simple-marker/createImageBitmap()from videoDocumentation
Modified:
README.mdWASM Binary Required
npm install artoolkit5-js # or place artoolkit.wasm in src/worker/artoolkit/Without WASM: worker initializes successfully (with warnings), returns empty detections, all APIs functional.
Detection Flow
Features:
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.