@pose-tracker/pose-estimation-web 0.1.0 → 0.2.0
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 +21 -4
- package/dist/index.cjs +536 -129
- package/dist/index.d.cts +100 -11
- package/dist/index.d.ts +100 -11
- package/dist/index.js +536 -130
- package/dist/pose-tracker.global.js +6 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,13 +19,28 @@ import { createPoseTracker } from '@pose-tracker/pose-estimation-web';
|
|
|
19
19
|
|
|
20
20
|
const pt = createPoseTracker({ model: 'movenet' });
|
|
21
21
|
pt.mount('#root');
|
|
22
|
-
await pt.start();
|
|
22
|
+
await pt.start(); // default source = camera (webcam)
|
|
23
23
|
pt.on('keypoints', (e) => console.log(e.keypoints));
|
|
24
24
|
|
|
25
25
|
// BlazePose (peer or CDN window.poseDetection / auto-inject):
|
|
26
26
|
await pt.setModel('blazepose');
|
|
27
|
+
|
|
28
|
+
// Uploaded video / still image:
|
|
29
|
+
await pt.setSource({ type: 'video', src: videoFile }); // File | Blob | URL | HTMLVideoElement
|
|
30
|
+
await pt.start();
|
|
31
|
+
await pt.setSource({ type: 'image', src: imageFile });
|
|
32
|
+
await pt.start(); // single-shot keypoints
|
|
33
|
+
await pt.analyze(); // re-run on the same image
|
|
27
34
|
```
|
|
28
35
|
|
|
36
|
+
## Input sources
|
|
37
|
+
|
|
38
|
+
| `PoseSource` | Behavior |
|
|
39
|
+
|---|---|
|
|
40
|
+
| `{ type: 'camera', facingMode? }` | Live `getUserMedia` (default) |
|
|
41
|
+
| `{ type: 'video', src }` | File / blob URL / `<video>` — stream while playing |
|
|
42
|
+
| `{ type: 'image', src }` | File / blob URL / `<img>` / ImageBitmap — one shot (+ `analyze()`) |
|
|
43
|
+
|
|
29
44
|
## Script tag (CDN)
|
|
30
45
|
|
|
31
46
|
The IIFE build exposes a **`PoseTracker`** global (`PoseTracker.createPoseTracker`, …).
|
|
@@ -42,7 +57,7 @@ The IIFE build exposes a **`PoseTracker`** global (`PoseTracker.createPoseTracke
|
|
|
42
57
|
<!-- 1) TensorFlow.js (peer — required before PoseTracker) -->
|
|
43
58
|
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@4.22.0/dist/tf.min.js"></script>
|
|
44
59
|
<!-- 2) PoseTracker IIFE (jsDelivr / unpkg both work) -->
|
|
45
|
-
<script src="https://cdn.jsdelivr.net/npm/@pose-tracker/pose-estimation-web@0.
|
|
60
|
+
<script src="https://cdn.jsdelivr.net/npm/@pose-tracker/pose-estimation-web@0.2.0/dist/pose-tracker.global.js"></script>
|
|
46
61
|
</head>
|
|
47
62
|
<body>
|
|
48
63
|
<div id="root" style="width: 100%; height: 100vh; background: #111"></div>
|
|
@@ -50,9 +65,11 @@ The IIFE build exposes a **`PoseTracker`** global (`PoseTracker.createPoseTracke
|
|
|
50
65
|
const pt = PoseTracker.createPoseTracker({
|
|
51
66
|
model: 'movenet',
|
|
52
67
|
drawSkeleton: true,
|
|
68
|
+
// source defaults to camera; also: { type:'video'|'image', src }
|
|
53
69
|
});
|
|
54
70
|
pt.mount('#root');
|
|
55
|
-
pt.start().catch(console.error);
|
|
71
|
+
pt.start().catch(console.error); // webcam
|
|
72
|
+
// pt.setSource({ type: 'image', src: file }).then(() => pt.start());
|
|
56
73
|
pt.on('keypoints', (e) => console.log(e.keypoints.length));
|
|
57
74
|
</script>
|
|
58
75
|
</body>
|
|
@@ -62,7 +79,7 @@ The IIFE build exposes a **`PoseTracker`** global (`PoseTracker.createPoseTracke
|
|
|
62
79
|
Equivalent unpkg URL:
|
|
63
80
|
|
|
64
81
|
```text
|
|
65
|
-
https://unpkg.com/@pose-tracker/pose-estimation-web@0.
|
|
82
|
+
https://unpkg.com/@pose-tracker/pose-estimation-web@0.2.0/dist/pose-tracker.global.js
|
|
66
83
|
```
|
|
67
84
|
|
|
68
85
|
Omitting `/dist/...` also works — `package.json` `jsdelivr` / `unpkg` fields point at the IIFE.
|