@kubohiroya/turbowarp-realtime-motion-capture 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.
Files changed (62) hide show
  1. package/LICENSE +373 -0
  2. package/README.ja.md +89 -0
  3. package/README.md +113 -0
  4. package/THIRD_PARTY_NOTICES.md +31 -0
  5. package/config/feature-flags.ts +28 -0
  6. package/config/qr-config.ts +19 -0
  7. package/dist/extension-manifest.json +664 -0
  8. package/dist/turbowarp-realtime-motion-capture.js +82631 -0
  9. package/docs/architecture.ja.md +256 -0
  10. package/docs/architecture.md +294 -0
  11. package/docs/index.html +83 -0
  12. package/docs/turbowarp-extension-api.ja.md +157 -0
  13. package/docs/turbowarp-extension-api.md +1033 -0
  14. package/package.json +105 -0
  15. package/schemas/camera-calibration-v1.json +209 -0
  16. package/schemas/extension-manifest.schema.json +49 -0
  17. package/schemas/performance-dsl-v1.json +72 -0
  18. package/schemas/pose-frame-2d-v1.json +626 -0
  19. package/schemas/pose-frame-2d-v2.json +723 -0
  20. package/schemas/pose-frame-3d-v1.json +714 -0
  21. package/schemas/session-policy-v1.json +138 -0
  22. package/src/avatar/aframe-port.ts +39 -0
  23. package/src/avatar/controller.ts +541 -0
  24. package/src/avatar/kalidokit-adapter.ts +193 -0
  25. package/src/avatar/types.ts +119 -0
  26. package/src/block-definitions.json +810 -0
  27. package/src/calibration/controller.ts +564 -0
  28. package/src/calibration/opencv-backend.ts +347 -0
  29. package/src/calibration/types.ts +53 -0
  30. package/src/config.ts +13 -0
  31. package/src/extension-manifest.ts +182 -0
  32. package/src/extension.ts +913 -0
  33. package/src/frame-sync/controller.ts +416 -0
  34. package/src/frame-sync/detector.ts +278 -0
  35. package/src/frame-sync/pattern-display.ts +161 -0
  36. package/src/frame-sync/pattern.ts +88 -0
  37. package/src/frame-sync/time-source.ts +36 -0
  38. package/src/frame-sync/types.ts +39 -0
  39. package/src/frame-sync/video-frame-pump.ts +116 -0
  40. package/src/fusion/controller.ts +554 -0
  41. package/src/fusion/fuse.ts +385 -0
  42. package/src/fusion/geometry.ts +474 -0
  43. package/src/fusion/glow-stick.ts +173 -0
  44. package/src/fusion/identity.ts +112 -0
  45. package/src/fusion/jitter-buffer.ts +439 -0
  46. package/src/fusion/types.ts +103 -0
  47. package/src/globals.d.ts +57 -0
  48. package/src/index.ts +8 -0
  49. package/src/markers/canvas-sampler.ts +59 -0
  50. package/src/markers/color.ts +53 -0
  51. package/src/markers/sampler.ts +185 -0
  52. package/src/markers/types.ts +49 -0
  53. package/src/pose/controller.ts +388 -0
  54. package/src/pose/pose-frame.ts +128 -0
  55. package/src/pose/tfjs-movenet.ts +34 -0
  56. package/src/pose/types.ts +116 -0
  57. package/src/protocol/codec.ts +248 -0
  58. package/src/protocol/schemas.ts +283 -0
  59. package/src/qr-courier.ts +289 -0
  60. package/src/qr-svg.ts +39 -0
  61. package/src/sprite-skin.ts +112 -0
  62. package/src/webrtc-capability.ts +38 -0
package/package.json ADDED
@@ -0,0 +1,105 @@
1
+ {
2
+ "name": "@kubohiroya/turbowarp-realtime-motion-capture",
3
+ "version": "0.2.0",
4
+ "description": "A TurboWarp camera and fusion pipeline for WebGPU multi-person pose estimation over WebRTC.",
5
+ "author": "Hiroya Kubo <hiroya@cuc.ac.jp>",
6
+ "license": "MPL-2.0",
7
+ "homepage": "https://kubohiroya.github.io/turbowarp-realtime-motion-capture/",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/kubohiroya/turbowarp-realtime-motion-capture.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/kubohiroya/turbowarp-realtime-motion-capture/issues"
14
+ },
15
+ "keywords": [
16
+ "turbowarp",
17
+ "scratch",
18
+ "extension",
19
+ "movenet",
20
+ "webgpu",
21
+ "webrtc",
22
+ "pose-estimation"
23
+ ],
24
+ "type": "module",
25
+ "files": [
26
+ "dist/",
27
+ "config/",
28
+ "docs/",
29
+ "schemas/",
30
+ "src/",
31
+ "README.md",
32
+ "README.ja.md",
33
+ "THIRD_PARTY_NOTICES.md",
34
+ "LICENSE"
35
+ ],
36
+ "publishConfig": {
37
+ "access": "public",
38
+ "registry": "https://registry.npmjs.org/"
39
+ },
40
+ "packageManager": "pnpm@11.18.0",
41
+ "engines": {
42
+ "node": ">=22.18.0"
43
+ },
44
+ "scripts": {
45
+ "dev": "vite build --watch",
46
+ "typecheck": "tsc --noEmit",
47
+ "build": "vite build",
48
+ "lint": "eslint config src tests scripts vite.config.ts",
49
+ "format": "prettier --write config src tests scripts vite.config.ts",
50
+ "format:check": "prettier --check config src tests scripts vite.config.ts",
51
+ "test": "vitest run",
52
+ "docs": "node scripts/generate-readme.ts",
53
+ "docs:check": "pnpm run docs && git diff --exit-code -- README.md docs/turbowarp-extension-api.md",
54
+ "schemas": "node scripts/generate-schemas.ts",
55
+ "schemas:check": "pnpm run schemas && node scripts/check-schemas.ts",
56
+ "repo:check": "node scripts/check-repo.ts",
57
+ "pack:check": "npm pack --dry-run --ignore-scripts",
58
+ "check": "pnpm run typecheck && pnpm run lint && pnpm run format:check && pnpm run test && pnpm run docs:check && pnpm run schemas:check && pnpm run check:dist && pnpm run repo:check && pnpm run pack:check",
59
+ "check:dist": "pnpm run build && node scripts/check-dist.ts"
60
+ },
61
+ "dependencies": {
62
+ "@sinclair/typebox": "0.34.52",
63
+ "@techstark/opencv-js": "4.12.0-release.1",
64
+ "@tensorflow-models/pose-detection": "2.1.3",
65
+ "@tensorflow/tfjs-backend-webgpu": "4.22.0",
66
+ "@tensorflow/tfjs-converter": "4.22.0",
67
+ "@tensorflow/tfjs-core": "4.22.0",
68
+ "kalidokit": "1.1.5",
69
+ "qrcode": "1.5.4"
70
+ },
71
+ "peerDependencies": {
72
+ "@kubohiroya/turbowarp-aframe": "0.3.0",
73
+ "@kubohiroya/turbowarp-camera-source": "0.5.0",
74
+ "@kubohiroya/turbowarp-jsqr": "0.3.0",
75
+ "@kubohiroya/turbowarp-webrtc": "0.3.0"
76
+ },
77
+ "peerDependenciesMeta": {
78
+ "@kubohiroya/turbowarp-aframe": {
79
+ "optional": true
80
+ },
81
+ "@kubohiroya/turbowarp-camera-source": {
82
+ "optional": true
83
+ },
84
+ "@kubohiroya/turbowarp-jsqr": {
85
+ "optional": true
86
+ },
87
+ "@kubohiroya/turbowarp-webrtc": {
88
+ "optional": true
89
+ }
90
+ },
91
+ "devDependencies": {
92
+ "@eslint/js": "^9.39.5",
93
+ "@kubohiroya/turbowarp-extension-template": "0.4.0",
94
+ "@kubohiroya/vite-plugin-turbowarp-extension": "0.4.0",
95
+ "@types/node": "^24.13.3",
96
+ "@types/qrcode": "1.5.6",
97
+ "eslint": "^9.39.5",
98
+ "jsqr": "^1.4.0",
99
+ "prettier": "^3.9.6",
100
+ "typescript": "^5.9.3",
101
+ "typescript-eslint": "^8.66.0",
102
+ "vite": "^8.2.2",
103
+ "vitest": "^4.1.10"
104
+ }
105
+ }
@@ -0,0 +1,209 @@
1
+ {
2
+ "additionalProperties": false,
3
+ "$id": "https://kubohiroya.github.io/multiview-pose/schema/camera-calibration-v1.json",
4
+ "type": "object",
5
+ "required": [
6
+ "schema",
7
+ "version",
8
+ "calibrationId",
9
+ "cameraId",
10
+ "imageWidth",
11
+ "imageHeight",
12
+ "intrinsicMatrix",
13
+ "distortionCoefficients",
14
+ "worldFromCameraMatrix",
15
+ "worldUnit",
16
+ "calibratedAt"
17
+ ],
18
+ "properties": {
19
+ "schema": {
20
+ "const": "twrmc/camera-calibration",
21
+ "type": "string"
22
+ },
23
+ "version": {
24
+ "const": 1,
25
+ "type": "number"
26
+ },
27
+ "calibrationId": {
28
+ "minLength": 1,
29
+ "maxLength": 64,
30
+ "pattern": "^[A-Za-z0-9._-]+$",
31
+ "type": "string"
32
+ },
33
+ "cameraId": {
34
+ "minLength": 1,
35
+ "maxLength": 64,
36
+ "pattern": "^[A-Za-z0-9._-]+$",
37
+ "type": "string"
38
+ },
39
+ "imageWidth": {
40
+ "minimum": 1,
41
+ "maximum": 16384,
42
+ "type": "integer"
43
+ },
44
+ "imageHeight": {
45
+ "minimum": 1,
46
+ "maximum": 16384,
47
+ "type": "integer"
48
+ },
49
+ "intrinsicMatrix": {
50
+ "type": "array",
51
+ "items": [
52
+ {
53
+ "minimum": -1000000,
54
+ "maximum": 1000000,
55
+ "type": "number"
56
+ },
57
+ {
58
+ "minimum": -1000000,
59
+ "maximum": 1000000,
60
+ "type": "number"
61
+ },
62
+ {
63
+ "minimum": -1000000,
64
+ "maximum": 1000000,
65
+ "type": "number"
66
+ },
67
+ {
68
+ "minimum": -1000000,
69
+ "maximum": 1000000,
70
+ "type": "number"
71
+ },
72
+ {
73
+ "minimum": -1000000,
74
+ "maximum": 1000000,
75
+ "type": "number"
76
+ },
77
+ {
78
+ "minimum": -1000000,
79
+ "maximum": 1000000,
80
+ "type": "number"
81
+ },
82
+ {
83
+ "minimum": -1000000,
84
+ "maximum": 1000000,
85
+ "type": "number"
86
+ },
87
+ {
88
+ "minimum": -1000000,
89
+ "maximum": 1000000,
90
+ "type": "number"
91
+ },
92
+ {
93
+ "minimum": -1000000,
94
+ "maximum": 1000000,
95
+ "type": "number"
96
+ }
97
+ ],
98
+ "additionalItems": false,
99
+ "minItems": 9,
100
+ "maxItems": 9
101
+ },
102
+ "distortionCoefficients": {
103
+ "minItems": 0,
104
+ "maxItems": 14,
105
+ "type": "array",
106
+ "items": {
107
+ "minimum": -1000000,
108
+ "maximum": 1000000,
109
+ "type": "number"
110
+ }
111
+ },
112
+ "worldFromCameraMatrix": {
113
+ "type": "array",
114
+ "items": [
115
+ {
116
+ "minimum": -1000000,
117
+ "maximum": 1000000,
118
+ "type": "number"
119
+ },
120
+ {
121
+ "minimum": -1000000,
122
+ "maximum": 1000000,
123
+ "type": "number"
124
+ },
125
+ {
126
+ "minimum": -1000000,
127
+ "maximum": 1000000,
128
+ "type": "number"
129
+ },
130
+ {
131
+ "minimum": -1000000,
132
+ "maximum": 1000000,
133
+ "type": "number"
134
+ },
135
+ {
136
+ "minimum": -1000000,
137
+ "maximum": 1000000,
138
+ "type": "number"
139
+ },
140
+ {
141
+ "minimum": -1000000,
142
+ "maximum": 1000000,
143
+ "type": "number"
144
+ },
145
+ {
146
+ "minimum": -1000000,
147
+ "maximum": 1000000,
148
+ "type": "number"
149
+ },
150
+ {
151
+ "minimum": -1000000,
152
+ "maximum": 1000000,
153
+ "type": "number"
154
+ },
155
+ {
156
+ "minimum": -1000000,
157
+ "maximum": 1000000,
158
+ "type": "number"
159
+ },
160
+ {
161
+ "minimum": -1000000,
162
+ "maximum": 1000000,
163
+ "type": "number"
164
+ },
165
+ {
166
+ "minimum": -1000000,
167
+ "maximum": 1000000,
168
+ "type": "number"
169
+ },
170
+ {
171
+ "minimum": -1000000,
172
+ "maximum": 1000000,
173
+ "type": "number"
174
+ },
175
+ {
176
+ "minimum": -1000000,
177
+ "maximum": 1000000,
178
+ "type": "number"
179
+ },
180
+ {
181
+ "minimum": -1000000,
182
+ "maximum": 1000000,
183
+ "type": "number"
184
+ },
185
+ {
186
+ "minimum": -1000000,
187
+ "maximum": 1000000,
188
+ "type": "number"
189
+ },
190
+ {
191
+ "minimum": -1000000,
192
+ "maximum": 1000000,
193
+ "type": "number"
194
+ }
195
+ ],
196
+ "additionalItems": false,
197
+ "minItems": 16,
198
+ "maxItems": 16
199
+ },
200
+ "worldUnit": {
201
+ "const": "meter",
202
+ "type": "string"
203
+ },
204
+ "calibratedAt": {
205
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z$",
206
+ "type": "string"
207
+ }
208
+ }
209
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://raw.githubusercontent.com/kubohiroya/turbowarp-extension-template/main/schemas/extension-manifest.schema.json",
4
+ "title": "TurboWarp Extension API Manifest",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["formatVersion", "id", "blocks", "menus"],
8
+ "properties": {
9
+ "formatVersion": {"const": 1},
10
+ "id": {"type": "string", "pattern": "^[a-z0-9]+$"},
11
+ "blocks": {
12
+ "type": "array",
13
+ "items": {
14
+ "type": "object",
15
+ "additionalProperties": false,
16
+ "required": ["opcode", "blockType", "arguments"],
17
+ "properties": {
18
+ "opcode": {"type": "string", "minLength": 1},
19
+ "blockType": {"type": "string", "minLength": 1},
20
+ "arguments": {
21
+ "type": "array",
22
+ "items": {
23
+ "type": "object",
24
+ "additionalProperties": false,
25
+ "required": ["id", "type"],
26
+ "properties": {
27
+ "id": {"type": "string", "minLength": 1},
28
+ "type": {"type": "string", "minLength": 1},
29
+ "menu": {"type": "string", "minLength": 1}
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ },
36
+ "menus": {
37
+ "type": "array",
38
+ "items": {
39
+ "type": "object",
40
+ "additionalProperties": false,
41
+ "required": ["id", "acceptReporters"],
42
+ "properties": {
43
+ "id": {"type": "string", "minLength": 1},
44
+ "acceptReporters": {"type": "boolean"}
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,72 @@
1
+ {
2
+ "additionalProperties": false,
3
+ "$id": "https://kubohiroya.github.io/multiview-pose/schema/performance-dsl-v1.json",
4
+ "type": "object",
5
+ "required": [
6
+ "schema",
7
+ "version",
8
+ "performers"
9
+ ],
10
+ "properties": {
11
+ "schema": {
12
+ "const": "twrmc/performance-dsl",
13
+ "type": "string"
14
+ },
15
+ "version": {
16
+ "const": 1,
17
+ "type": "number"
18
+ },
19
+ "performers": {
20
+ "minItems": 1,
21
+ "maxItems": 6,
22
+ "type": "array",
23
+ "items": {
24
+ "additionalProperties": false,
25
+ "type": "object",
26
+ "required": [
27
+ "performerId",
28
+ "displayName",
29
+ "glowStickColor",
30
+ "recognitionStartEffect",
31
+ "recognitionEndEffect",
32
+ "avatarAsset"
33
+ ],
34
+ "properties": {
35
+ "performerId": {
36
+ "minLength": 1,
37
+ "maxLength": 64,
38
+ "pattern": "^[A-Za-z0-9._-]+$",
39
+ "type": "string"
40
+ },
41
+ "displayName": {
42
+ "minLength": 1,
43
+ "maxLength": 80,
44
+ "type": "string"
45
+ },
46
+ "glowStickColor": {
47
+ "pattern": "^#[0-9A-Fa-f]{6}$",
48
+ "type": "string"
49
+ },
50
+ "recognitionStartEffect": {
51
+ "minLength": 1,
52
+ "maxLength": 64,
53
+ "pattern": "^[A-Za-z0-9._-]+$",
54
+ "type": "string"
55
+ },
56
+ "recognitionEndEffect": {
57
+ "minLength": 1,
58
+ "maxLength": 64,
59
+ "pattern": "^[A-Za-z0-9._-]+$",
60
+ "type": "string"
61
+ },
62
+ "avatarAsset": {
63
+ "minLength": 1,
64
+ "maxLength": 64,
65
+ "pattern": "^[A-Za-z0-9._-]+$",
66
+ "type": "string"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }