@srsergio/taptapp-ar 1.0.52 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -136,8 +136,73 @@ ar.stop();
|
|
|
136
136
|
|
|
137
137
|
---
|
|
138
138
|
|
|
139
|
-
###
|
|
140
|
-
|
|
139
|
+
### 2. Raw Controller (Advanced & Custom Engines)
|
|
140
|
+
The `Controller` is the core engine of TapTapp AR. You can use it to build your own AR components or integrate tracking into custom 3D engines.
|
|
141
|
+
|
|
142
|
+
#### ⚙️ Controller Configuration
|
|
143
|
+
| Property | Default | Description |
|
|
144
|
+
| :--- | :--- | :--- |
|
|
145
|
+
| `inputWidth` | **Required** | The width of the video or image source. |
|
|
146
|
+
| `inputHeight` | **Required** | The height of the video or image source. |
|
|
147
|
+
| `maxTrack` | `1` | Max number of images to track simultaneously. |
|
|
148
|
+
| `warmupTolerance` | `5` | Frames of consistent detection needed to "lock" a target. |
|
|
149
|
+
| `missTolerance` | `5` | Frames of missed detection before considering the target "lost". |
|
|
150
|
+
| `filterMinCF` | `0.001` | Min cutoff frequency for the OneEuroFilter (reduces jitter). |
|
|
151
|
+
| `filterBeta` | `1000` | Filter beta parameter (higher = more responsive, lower = smoother). |
|
|
152
|
+
| `onUpdate` | `null` | Callback for tracking events (Found, Lost, ProcessDone). |
|
|
153
|
+
| `debugMode` | `false` | If true, returns extra debug data (cropped images, feature points). |
|
|
154
|
+
| `worker` | `null` | Pass a custom worker instance if using a specialized environment. |
|
|
155
|
+
|
|
156
|
+
#### 🚀 Example: Tracking a Video Stream
|
|
157
|
+
Ideal for real-time AR apps in the browser:
|
|
158
|
+
|
|
159
|
+
```javascript
|
|
160
|
+
import { Controller } from '@srsergio/taptapp-ar';
|
|
161
|
+
|
|
162
|
+
const controller = new Controller({
|
|
163
|
+
inputWidth: video.videoWidth,
|
|
164
|
+
inputHeight: video.videoHeight,
|
|
165
|
+
onUpdate: (data) => {
|
|
166
|
+
if (data.type === 'updateMatrix') {
|
|
167
|
+
const { targetIndex, worldMatrix } = data;
|
|
168
|
+
if (worldMatrix) {
|
|
169
|
+
console.log(`Target ${targetIndex} detected! Matrix:`, worldMatrix);
|
|
170
|
+
// Apply worldMatrix (Float32Array[16]) to your 3D object
|
|
171
|
+
} else {
|
|
172
|
+
console.log(`Target ${targetIndex} lost.`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Single target
|
|
179
|
+
await controller.addImageTargets('./targets.taar');
|
|
180
|
+
|
|
181
|
+
// OR multiple targets from different .taar files
|
|
182
|
+
await controller.addImageTargets(['./target1.taar', './target2.taar', './target3.taar']);
|
|
183
|
+
controller.processVideo(videoElement); // Starts the internal RAF loop
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### 📸 Example: One-shot Image Matching
|
|
187
|
+
Use this for "Snap and Detect" features without a continuous video loop:
|
|
188
|
+
|
|
189
|
+
```javascript
|
|
190
|
+
const controller = new Controller({ inputWidth: 1024, inputHeight: 1024 });
|
|
191
|
+
await controller.addImageTargets('./targets.taar');
|
|
192
|
+
|
|
193
|
+
// 1. Detect features in a static image
|
|
194
|
+
const { featurePoints } = await controller.detect(canvasElement);
|
|
195
|
+
|
|
196
|
+
// 2. Attempt to match against a specific target index
|
|
197
|
+
const { targetIndex, modelViewTransform } = await controller.match(featurePoints, 0);
|
|
198
|
+
|
|
199
|
+
if (targetIndex !== -1) {
|
|
200
|
+
// Found a match! Use modelViewTransform for initial pose estimation
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### 📚 Legacy Usage
|
|
205
|
+
For **A-Frame** or **Three.js** wrappers, please refer to the [Advanced Usage Documentation](./docs/advanced-usage.md).
|
|
141
206
|
|
|
142
207
|
---
|
|
143
208
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srsergio/taptapp-ar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.53",
|
|
4
4
|
"description": "Ultra-fast, lightweight Augmented Reality Image Tracking SDK for the web. Features an optimized offline compiler, React components, and compatibility with Three.js/A-Frame. No heavy ML frameworks required.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-ar",
|