@pose-tracker/react-native-pose-estimation-light 0.1.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/LICENSE +45 -0
- package/PoseTrackerVision.podspec +28 -0
- package/README.md +161 -0
- package/THIRD_PARTY_NOTICES.md +19 -0
- package/ios/PoseTrackerVision/PoseTrackerBodyPosePlugin.m +18 -0
- package/ios/PoseTrackerVision/PoseTrackerBodyPosePlugin.swift +108 -0
- package/lib/PoseTrackerProvider.d.ts +102 -0
- package/lib/PoseTrackerProvider.js +204 -0
- package/lib/api/configure.d.ts +29 -0
- package/lib/api/configure.js +64 -0
- package/lib/api/skeleton.d.ts +17 -0
- package/lib/api/skeleton.js +53 -0
- package/lib/api/track.d.ts +61 -0
- package/lib/api/track.js +146 -0
- package/lib/backends/PoseBackend.d.ts +50 -0
- package/lib/backends/PoseBackend.js +11 -0
- package/lib/backends/vision/VisionPoseBackend.d.ts +72 -0
- package/lib/backends/vision/VisionPoseBackend.js +177 -0
- package/lib/backends/vision/mapVisionJoints.d.ts +35 -0
- package/lib/backends/vision/mapVisionJoints.js +162 -0
- package/lib/backends/vision/optionalVision.d.ts +32 -0
- package/lib/backends/vision/optionalVision.js +76 -0
- package/lib/backends/webview/WebViewPoseBackend.d.ts +223 -0
- package/lib/backends/webview/WebViewPoseBackend.js +382 -0
- package/lib/backends/webview/brandAssets.d.ts +5 -0
- package/lib/backends/webview/brandAssets.js +8 -0
- package/lib/backends/webview/onlineRuntime.d.ts +45 -0
- package/lib/backends/webview/onlineRuntime.js +57 -0
- package/lib/backends/webview/poseHtml.d.ts +71 -0
- package/lib/backends/webview/poseHtml.js +188 -0
- package/lib/backends/webview/poseRuntimeSource.d.ts +3 -0
- package/lib/backends/webview/poseRuntimeSource.js +4 -0
- package/lib/cache/obfuscate.d.ts +18 -0
- package/lib/cache/obfuscate.js +90 -0
- package/lib/camera/PoseCameraView.d.ts +51 -0
- package/lib/camera/PoseCameraView.js +99 -0
- package/lib/camera/WebViewPoseView.d.ts +81 -0
- package/lib/camera/WebViewPoseView.js +312 -0
- package/lib/client.d.ts +361 -0
- package/lib/client.js +1046 -0
- package/lib/diagnostics/logReport.d.ts +23 -0
- package/lib/diagnostics/logReport.js +102 -0
- package/lib/engine/EngineLoader.d.ts +95 -0
- package/lib/engine/EngineLoader.js +347 -0
- package/lib/engine/types.d.ts +83 -0
- package/lib/engine/types.js +11 -0
- package/lib/events/classicMessage.d.ts +31 -0
- package/lib/events/classicMessage.js +259 -0
- package/lib/exercises/aliases.d.ts +18 -0
- package/lib/exercises/aliases.js +48 -0
- package/lib/index.d.ts +72 -0
- package/lib/index.js +170 -0
- package/lib/models/poseModels.d.ts +39 -0
- package/lib/models/poseModels.js +63 -0
- package/lib/quality/AdaptiveQualityController.d.ts +120 -0
- package/lib/quality/AdaptiveQualityController.js +423 -0
- package/lib/quality/RuntimeGuard.d.ts +34 -0
- package/lib/quality/RuntimeGuard.js +105 -0
- package/lib/quality/captureMode.d.ts +82 -0
- package/lib/quality/captureMode.js +75 -0
- package/lib/quality/deviceCapability.d.ts +37 -0
- package/lib/quality/deviceCapability.js +177 -0
- package/lib/quality/profiles.d.ts +125 -0
- package/lib/quality/profiles.js +202 -0
- package/lib/runtime/RuntimeCache.d.ts +75 -0
- package/lib/runtime/RuntimeCache.js +230 -0
- package/lib/sdkVersion.d.ts +2 -0
- package/lib/sdkVersion.js +5 -0
- package/lib/support/optionalModules.d.ts +46 -0
- package/lib/support/optionalModules.js +82 -0
- package/lib/types/acceleration.d.ts +86 -0
- package/lib/types/acceleration.js +15 -0
- package/lib/types/events.d.ts +345 -0
- package/lib/types/events.js +10 -0
- package/lib/types/features.d.ts +90 -0
- package/lib/types/features.js +122 -0
- package/lib/types/manifest.d.ts +197 -0
- package/lib/types/manifest.js +10 -0
- package/lib/types/pose.d.ts +36 -0
- package/lib/types/pose.js +41 -0
- package/lib/types/preload.d.ts +17 -0
- package/lib/types/preload.js +10 -0
- package/lib/types/skeleton.d.ts +29 -0
- package/lib/types/skeleton.js +52 -0
- package/package.json +92 -0
- package/react-native.config.js +12 -0
- package/src/PoseTrackerProvider.tsx +332 -0
- package/src/api/configure.ts +82 -0
- package/src/api/skeleton.ts +60 -0
- package/src/api/track.ts +182 -0
- package/src/backends/PoseBackend.ts +59 -0
- package/src/backends/vision/VisionPoseBackend.ts +238 -0
- package/src/backends/vision/mapVisionJoints.ts +185 -0
- package/src/backends/vision/optionalVision.ts +94 -0
- package/src/backends/webview/WebViewPoseBackend.ts +582 -0
- package/src/backends/webview/brandAssets.ts +5 -0
- package/src/backends/webview/onlineRuntime.ts +94 -0
- package/src/backends/webview/poseHtml.ts +259 -0
- package/src/backends/webview/poseRuntimeSource.d.ts +3 -0
- package/src/cache/obfuscate.ts +94 -0
- package/src/camera/PoseCameraView.tsx +223 -0
- package/src/camera/WebViewPoseView.tsx +466 -0
- package/src/client.ts +1295 -0
- package/src/diagnostics/logReport.ts +131 -0
- package/src/engine/EngineLoader.ts +428 -0
- package/src/engine/types.ts +93 -0
- package/src/events/classicMessage.ts +271 -0
- package/src/exercises/aliases.ts +50 -0
- package/src/index.ts +243 -0
- package/src/models/poseModels.ts +93 -0
- package/src/quality/AdaptiveQualityController.ts +579 -0
- package/src/quality/RuntimeGuard.ts +119 -0
- package/src/quality/captureMode.ts +97 -0
- package/src/quality/deviceCapability.ts +187 -0
- package/src/quality/profiles.ts +253 -0
- package/src/runtime/RuntimeCache.ts +300 -0
- package/src/sdkVersion.ts +2 -0
- package/src/support/optionalModules.ts +114 -0
- package/src/types/acceleration.ts +94 -0
- package/src/types/events.ts +437 -0
- package/src/types/features.ts +176 -0
- package/src/types/manifest.ts +230 -0
- package/src/types/pose.ts +85 -0
- package/src/types/preload.ts +19 -0
- package/src/types/skeleton.ts +77 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the `POST /api/sdk/configure` handshake response ("manifest").
|
|
3
|
+
*
|
|
4
|
+
* The manifest is the single source of truth for server-driven behavior:
|
|
5
|
+
* exercise definitions (angle thresholds, rep state machines), reference
|
|
6
|
+
* movements, engine bundle distribution and model profiles. Updating the
|
|
7
|
+
* manifest server-side changes SDK behavior without republishing the app.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Model profiles (Sency-style). In v1 every profile maps to the bundled
|
|
11
|
+
* MoveNet SinglePose Lightning model; the fields below exist so the backend
|
|
12
|
+
* can later distribute per-profile models (e.g. Thunder for Prime, custom
|
|
13
|
+
* TFLite for native backends) without breaking older SDKs.
|
|
14
|
+
*/
|
|
15
|
+
export type PoseModelProfile = 'UltraLite' | 'Lite' | 'Pro' | 'Prime' | 'AdaptiveChoice';
|
|
16
|
+
export type ModelFormat = 'tfjs-graph-model' | 'tflite' | 'coreml';
|
|
17
|
+
export interface ModelDescriptor {
|
|
18
|
+
/** Stable identifier, e.g. "movenet-singlepose-lightning". */
|
|
19
|
+
modelId: string;
|
|
20
|
+
format: ModelFormat;
|
|
21
|
+
/** Square input resolution in pixels (192 for MoveNet Lightning). */
|
|
22
|
+
inputSize: number;
|
|
23
|
+
/**
|
|
24
|
+
* Signed (token-gated) download URL for a standalone model archive, or
|
|
25
|
+
* null/absent when the model is delivered by another channel (stub-loader
|
|
26
|
+
* architecture: MoveNet ships inside the `pose-runtime` payload).
|
|
27
|
+
*/
|
|
28
|
+
signedUrl?: string | null;
|
|
29
|
+
/** SHA-256 hex digest of the downloadable archive (null when signedUrl is null). */
|
|
30
|
+
sha256?: string | null;
|
|
31
|
+
/** Delivery channel; 'pose-runtime' = part of the public runtime payload. */
|
|
32
|
+
deliveredBy?: 'pose-runtime';
|
|
33
|
+
version: string;
|
|
34
|
+
}
|
|
35
|
+
/** Maps each profile to a model. v1: all profiles point to the same MoveNet entry. */
|
|
36
|
+
export type ModelsByProfile = Record<Exclude<PoseModelProfile, 'AdaptiveChoice'>, ModelDescriptor>;
|
|
37
|
+
/**
|
|
38
|
+
* Full movement definition, mirroring the Strapi content-types
|
|
39
|
+
* (`api::movement.movement` + steps/parameters/recommendations/initial
|
|
40
|
+
* posture) that already drive the WebView engine. The remote engine bundle
|
|
41
|
+
* consumes this structure as-is, so movements/exercises created or tuned in
|
|
42
|
+
* the dashboard update SDK behavior without any republish.
|
|
43
|
+
*/
|
|
44
|
+
export interface MovementStepParameter {
|
|
45
|
+
/** Keypoint/angle selector; `a||b` accepts either side (front convention). */
|
|
46
|
+
name: string;
|
|
47
|
+
type: 'angle' | 'upper_y' | 'matching_y' | 'same_y' | 'matching_x' | 'same_x' | 'distance_y';
|
|
48
|
+
/** Weight of this parameter within the step (0–100). */
|
|
49
|
+
percentage: number;
|
|
50
|
+
operator?: string;
|
|
51
|
+
value?: number;
|
|
52
|
+
reference?: string;
|
|
53
|
+
/** When true, the parameter is included in `step_completion` payloads. */
|
|
54
|
+
public?: boolean;
|
|
55
|
+
/** Per-difficulty acceptance values (e.g. { easy: 90, medium: 100 }). */
|
|
56
|
+
scale_acceptance?: Record<string, number>;
|
|
57
|
+
/** Acceptance values when the camera point of view is elevated. */
|
|
58
|
+
upper_scale_acceptance?: Record<string, number>;
|
|
59
|
+
}
|
|
60
|
+
export interface MovementRecommendation {
|
|
61
|
+
name: string;
|
|
62
|
+
type: 'angle' | 'body_axe_without_arms' | 'upper_y' | 'matching_x';
|
|
63
|
+
operator: string;
|
|
64
|
+
value?: number;
|
|
65
|
+
reference?: string;
|
|
66
|
+
recommendation_text: string;
|
|
67
|
+
scale_acceptance?: Record<string, number>;
|
|
68
|
+
upper_scale_acceptance?: Record<string, number>;
|
|
69
|
+
}
|
|
70
|
+
export interface MovementStep {
|
|
71
|
+
name: string;
|
|
72
|
+
/** Order of the step within the movement (0-based). */
|
|
73
|
+
position: number;
|
|
74
|
+
/** Contribution of this step to the overall 0–100 progression. */
|
|
75
|
+
percentage: number;
|
|
76
|
+
/** Per-difficulty completion threshold to validate the step. */
|
|
77
|
+
scale_acceptance: Record<string, number>;
|
|
78
|
+
movement_parameters: MovementStepParameter[];
|
|
79
|
+
movement_recommendations: MovementRecommendation[];
|
|
80
|
+
}
|
|
81
|
+
export interface InitialPosture {
|
|
82
|
+
/** Expected orientation: 'face' or 'profile'. */
|
|
83
|
+
type: string;
|
|
84
|
+
/** Keypoints that must be visible inside the placement box. */
|
|
85
|
+
required_points: string[];
|
|
86
|
+
/** Placement box paddings, in % of the frame. */
|
|
87
|
+
padding_horizontal?: number | string;
|
|
88
|
+
padding_vertical?: number | string;
|
|
89
|
+
}
|
|
90
|
+
export interface MovementDefinition {
|
|
91
|
+
name: string;
|
|
92
|
+
type: 'dynamic' | 'static';
|
|
93
|
+
scale_acceptance: Record<string, number>;
|
|
94
|
+
movement_steps: MovementStep[];
|
|
95
|
+
movement_initial_posture: InitialPosture | null;
|
|
96
|
+
custom_skeleton?: string | null;
|
|
97
|
+
silhouette_image_url?: string | null;
|
|
98
|
+
}
|
|
99
|
+
export interface ExerciseConfig {
|
|
100
|
+
/** Stable identifier, e.g. "squat". */
|
|
101
|
+
id: string;
|
|
102
|
+
name: string;
|
|
103
|
+
type: 'dynamic' | 'static';
|
|
104
|
+
/**
|
|
105
|
+
* Full server-driven definition, consumed by the remote engine bundle.
|
|
106
|
+
* Exercise configs only ever exist behind a validated handshake (live or
|
|
107
|
+
* encrypted session cache) — the npm package ships zero movement
|
|
108
|
+
* intelligence (commercial boundary, see ARCHITECTURE.md §Modes).
|
|
109
|
+
*/
|
|
110
|
+
movement: MovementDefinition;
|
|
111
|
+
}
|
|
112
|
+
export interface ReferenceMovementDescriptor {
|
|
113
|
+
uuid: string;
|
|
114
|
+
name: string;
|
|
115
|
+
/** Signed URL to the movement signature JSON (angles/ratios/deltas over time). */
|
|
116
|
+
signedSignatureUrl: string;
|
|
117
|
+
sha256: string;
|
|
118
|
+
}
|
|
119
|
+
export interface EngineBundleDescriptor {
|
|
120
|
+
version: string;
|
|
121
|
+
/** Signed, token-gated URL of the JS engine bundle. */
|
|
122
|
+
signedUrl: string;
|
|
123
|
+
/** SHA-256 hex digest used for integrity validation after download. */
|
|
124
|
+
sha256: string;
|
|
125
|
+
/** Minimum SDK version able to run this bundle (semver). */
|
|
126
|
+
minSdkVersion: string;
|
|
127
|
+
/** True when the version sent in `localVersions.engine` is already current. */
|
|
128
|
+
upToDate?: boolean;
|
|
129
|
+
}
|
|
130
|
+
export interface PoseRuntimePartDescriptor {
|
|
131
|
+
/** Download URL of this part (`GET /api/sdk/pose-runtime?part=...&v=...`). */
|
|
132
|
+
url: string;
|
|
133
|
+
/** SHA-256 hex digest, verified BEFORE the part is committed to the cache. */
|
|
134
|
+
sha256: string;
|
|
135
|
+
bytes: number;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Descriptor of the public pose estimation payload (TF.js + MoveNet +
|
|
139
|
+
* proprietary pipeline wasm + page runtime). No API key required: pose
|
|
140
|
+
* estimation is the free tier; the movement engine stays key-gated.
|
|
141
|
+
*/
|
|
142
|
+
export interface PoseRuntimeDescriptor {
|
|
143
|
+
version: string;
|
|
144
|
+
/** True when the version sent in `localVersions.poseRuntime` is current. */
|
|
145
|
+
upToDate?: boolean;
|
|
146
|
+
baseUrl?: string;
|
|
147
|
+
/** Parts by name: tfjs, tfjs-wasm, model, weights, pipeline, runtime. */
|
|
148
|
+
parts: Record<string, PoseRuntimePartDescriptor>;
|
|
149
|
+
}
|
|
150
|
+
export interface ConfigureRequest {
|
|
151
|
+
/** Optional: keyless handshakes get the public manifest (pose-runtime only). */
|
|
152
|
+
apiToken?: string;
|
|
153
|
+
sdkName: 'posetracker-rn' | 'posetracker-rn-light';
|
|
154
|
+
sdkVersion: string;
|
|
155
|
+
targetPlatform: 'ios' | 'android';
|
|
156
|
+
/** Requested profile; the backend may downgrade it based on plan. */
|
|
157
|
+
poseModelProfile: PoseModelProfile;
|
|
158
|
+
/** Locale for localized strings in configs (hints, recommendations). */
|
|
159
|
+
locale?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Versions currently committed to the local caches; the backend answers
|
|
162
|
+
* with `upToDate` flags per module so unchanged payloads are not
|
|
163
|
+
* re-downloaded.
|
|
164
|
+
*/
|
|
165
|
+
localVersions?: {
|
|
166
|
+
poseRuntime?: string | null;
|
|
167
|
+
engine?: string | null;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
export interface PlanInfo {
|
|
171
|
+
plan: string;
|
|
172
|
+
/** Remaining API calls for the current period; null = unlimited. */
|
|
173
|
+
remainingCalls: number | null;
|
|
174
|
+
commercialUse: boolean;
|
|
175
|
+
}
|
|
176
|
+
export interface SdkManifest {
|
|
177
|
+
/**
|
|
178
|
+
* Short-lived session token for follow-up SDK requests (downloads, usage
|
|
179
|
+
* pings). Null on keyless handshakes (public manifest).
|
|
180
|
+
*/
|
|
181
|
+
sessionToken: string | null;
|
|
182
|
+
/** Null on keyless handshakes. */
|
|
183
|
+
plan: PlanInfo | null;
|
|
184
|
+
models: ModelsByProfile;
|
|
185
|
+
/** Profile the backend resolved for this device/plan. */
|
|
186
|
+
resolvedProfile: Exclude<PoseModelProfile, 'AdaptiveChoice'>;
|
|
187
|
+
/** Public pose estimation payload (always present, key or not). */
|
|
188
|
+
poseRuntime: PoseRuntimeDescriptor | null;
|
|
189
|
+
/** Null on keyless handshakes or when no engine bundle is deployed. */
|
|
190
|
+
engine: EngineBundleDescriptor | null;
|
|
191
|
+
exercises: ExerciseConfig[];
|
|
192
|
+
referenceMovements: ReferenceMovementDescriptor[];
|
|
193
|
+
/** Revocation signal: when true the SDK purges its sealed engine cache. */
|
|
194
|
+
revoked?: boolean;
|
|
195
|
+
/** Unix epoch ms after which the SDK should re-run the handshake. */
|
|
196
|
+
expiresAt: number;
|
|
197
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Types for the `POST /api/sdk/configure` handshake response ("manifest").
|
|
4
|
+
*
|
|
5
|
+
* The manifest is the single source of truth for server-driven behavior:
|
|
6
|
+
* exercise definitions (angle thresholds, rep state machines), reference
|
|
7
|
+
* movements, engine bundle distribution and model profiles. Updating the
|
|
8
|
+
* manifest server-side changes SDK behavior without republishing the app.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backend-agnostic pose types.
|
|
3
|
+
*
|
|
4
|
+
* MoveNet backends emit the 17-point COCO topology. Apple Vision
|
|
5
|
+
* (`VNDetectHumanBodyPoseRequest`) emits those 17 plus two extras
|
|
6
|
+
* (`neck`, `root`) — see `VISION_EXTRA_KEYPOINT_NAMES` and
|
|
7
|
+
* docs/NATIVE_POSE_BACKENDS.md. Downstream engine code that only knows
|
|
8
|
+
* COCO safely ignores unknown names.
|
|
9
|
+
*/
|
|
10
|
+
export type CocoKeypointName = 'nose' | 'left_eye' | 'right_eye' | 'left_ear' | 'right_ear' | 'left_shoulder' | 'right_shoulder' | 'left_elbow' | 'right_elbow' | 'left_wrist' | 'right_wrist' | 'left_hip' | 'right_hip' | 'left_knee' | 'right_knee' | 'left_ankle' | 'right_ankle';
|
|
11
|
+
/** Extra joints from Apple Vision body pose (not in COCO-17 / MoveNet). */
|
|
12
|
+
export type VisionExtraKeypointName = 'neck' | 'root';
|
|
13
|
+
export type KeypointName = CocoKeypointName | VisionExtraKeypointName;
|
|
14
|
+
export declare const COCO_KEYPOINT_NAMES: readonly CocoKeypointName[];
|
|
15
|
+
/** Vision-only joints appended after the COCO-aligned 17. */
|
|
16
|
+
export declare const VISION_EXTRA_KEYPOINT_NAMES: readonly VisionExtraKeypointName[];
|
|
17
|
+
/** Full Apple Vision body-pose set (19): COCO-17 + neck + root. */
|
|
18
|
+
export declare const VISION_KEYPOINT_NAMES: readonly KeypointName[];
|
|
19
|
+
export interface Keypoint {
|
|
20
|
+
name: KeypointName;
|
|
21
|
+
/** Horizontal position, normalized to [0, 1] relative to the input image width. */
|
|
22
|
+
x: number;
|
|
23
|
+
/** Vertical position, normalized to [0, 1] relative to the input image height. */
|
|
24
|
+
y: number;
|
|
25
|
+
/** Optional depth (reserved for future 3D-capable backends). */
|
|
26
|
+
z?: number;
|
|
27
|
+
/** Confidence score in [0, 1]. */
|
|
28
|
+
score: number;
|
|
29
|
+
}
|
|
30
|
+
export interface Pose {
|
|
31
|
+
keypoints: Keypoint[];
|
|
32
|
+
/** Overall pose confidence in [0, 1] (mean of keypoint scores for MoveNet). */
|
|
33
|
+
score: number;
|
|
34
|
+
/** Capture timestamp in milliseconds (host clock). */
|
|
35
|
+
timestampMs: number;
|
|
36
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Backend-agnostic pose types.
|
|
4
|
+
*
|
|
5
|
+
* MoveNet backends emit the 17-point COCO topology. Apple Vision
|
|
6
|
+
* (`VNDetectHumanBodyPoseRequest`) emits those 17 plus two extras
|
|
7
|
+
* (`neck`, `root`) — see `VISION_EXTRA_KEYPOINT_NAMES` and
|
|
8
|
+
* docs/NATIVE_POSE_BACKENDS.md. Downstream engine code that only knows
|
|
9
|
+
* COCO safely ignores unknown names.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.VISION_KEYPOINT_NAMES = exports.VISION_EXTRA_KEYPOINT_NAMES = exports.COCO_KEYPOINT_NAMES = void 0;
|
|
13
|
+
exports.COCO_KEYPOINT_NAMES = [
|
|
14
|
+
'nose',
|
|
15
|
+
'left_eye',
|
|
16
|
+
'right_eye',
|
|
17
|
+
'left_ear',
|
|
18
|
+
'right_ear',
|
|
19
|
+
'left_shoulder',
|
|
20
|
+
'right_shoulder',
|
|
21
|
+
'left_elbow',
|
|
22
|
+
'right_elbow',
|
|
23
|
+
'left_wrist',
|
|
24
|
+
'right_wrist',
|
|
25
|
+
'left_hip',
|
|
26
|
+
'right_hip',
|
|
27
|
+
'left_knee',
|
|
28
|
+
'right_knee',
|
|
29
|
+
'left_ankle',
|
|
30
|
+
'right_ankle',
|
|
31
|
+
];
|
|
32
|
+
/** Vision-only joints appended after the COCO-aligned 17. */
|
|
33
|
+
exports.VISION_EXTRA_KEYPOINT_NAMES = [
|
|
34
|
+
'neck',
|
|
35
|
+
'root',
|
|
36
|
+
];
|
|
37
|
+
/** Full Apple Vision body-pose set (19): COCO-17 + neck + root. */
|
|
38
|
+
exports.VISION_KEYPOINT_NAMES = [
|
|
39
|
+
...exports.COCO_KEYPOINT_NAMES,
|
|
40
|
+
...exports.VISION_EXTRA_KEYPOINT_NAMES,
|
|
41
|
+
];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cold-start / preload modes for {@link PoseTrackerClient.preload}.
|
|
3
|
+
*
|
|
4
|
+
* - `basic` (default): load MoveNet + warm TF.js/WebGL with zero tensors.
|
|
5
|
+
* Does **not** call `getUserMedia` — no unexpected camera permission prompt.
|
|
6
|
+
* - `full`: also open the camera during warm-up (legacy behaviour). Only use
|
|
7
|
+
* when the host UI is already in a camera context the user expects.
|
|
8
|
+
*/
|
|
9
|
+
export type ColdStartMode = 'basic' | 'full';
|
|
10
|
+
export interface PreloadOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Cold-start depth. Default `basic`.
|
|
13
|
+
* Pass `full` only when you intentionally want getUserMedia during preload
|
|
14
|
+
* (e.g. a visible camera screen that also warms the model).
|
|
15
|
+
*/
|
|
16
|
+
coldStart?: ColdStartMode;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cold-start / preload modes for {@link PoseTrackerClient.preload}.
|
|
4
|
+
*
|
|
5
|
+
* - `basic` (default): load MoveNet + warm TF.js/WebGL with zero tensors.
|
|
6
|
+
* Does **not** call `getUserMedia` — no unexpected camera permission prompt.
|
|
7
|
+
* - `full`: also open the camera during warm-up (legacy behaviour). Only use
|
|
8
|
+
* when the host UI is already in a camera context the user expects.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skeleton overlay definition — same JSON shape as Strapi `api::skeleton.skeleton`
|
|
3
|
+
* / PoseTrackerFront `DEFAULT_SKELETON` (WebView `?skeleton=<api_uuid>`).
|
|
4
|
+
*/
|
|
5
|
+
export interface SkeletonCirclesStyle {
|
|
6
|
+
circleFillColor: string;
|
|
7
|
+
circleStrokeColor: string;
|
|
8
|
+
strokeWidth: string | number;
|
|
9
|
+
radius: string | number;
|
|
10
|
+
}
|
|
11
|
+
export interface SkeletonLinesStyle {
|
|
12
|
+
lineStrokeColor: string;
|
|
13
|
+
strokeWidth: string | number;
|
|
14
|
+
}
|
|
15
|
+
export interface SkeletonAnglesStyle {
|
|
16
|
+
fontColor?: string;
|
|
17
|
+
strokeColor?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SkeletonDefinition {
|
|
20
|
+
keypoints: string[];
|
|
21
|
+
/** Named pairs `"left_hip||left_knee"`. */
|
|
22
|
+
keypoint_lines: string[];
|
|
23
|
+
keypoint_angles?: string[];
|
|
24
|
+
circles: SkeletonCirclesStyle;
|
|
25
|
+
lines: SkeletonLinesStyle;
|
|
26
|
+
angles?: SkeletonAnglesStyle;
|
|
27
|
+
}
|
|
28
|
+
/** PoseTracker API default (navy `#010A73` + gold `#FFC300`). */
|
|
29
|
+
export declare const DEFAULT_SKELETON_DEFINITION: SkeletonDefinition;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Skeleton overlay definition — same JSON shape as Strapi `api::skeleton.skeleton`
|
|
4
|
+
* / PoseTrackerFront `DEFAULT_SKELETON` (WebView `?skeleton=<api_uuid>`).
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.DEFAULT_SKELETON_DEFINITION = void 0;
|
|
8
|
+
/** PoseTracker API default (navy `#010A73` + gold `#FFC300`). */
|
|
9
|
+
exports.DEFAULT_SKELETON_DEFINITION = {
|
|
10
|
+
keypoints: [
|
|
11
|
+
'nose',
|
|
12
|
+
'left_eye',
|
|
13
|
+
'right_eye',
|
|
14
|
+
'left_ear',
|
|
15
|
+
'right_ear',
|
|
16
|
+
'left_shoulder',
|
|
17
|
+
'right_shoulder',
|
|
18
|
+
'left_elbow',
|
|
19
|
+
'right_elbow',
|
|
20
|
+
'left_wrist',
|
|
21
|
+
'right_wrist',
|
|
22
|
+
'left_hip',
|
|
23
|
+
'right_hip',
|
|
24
|
+
'left_knee',
|
|
25
|
+
'right_knee',
|
|
26
|
+
'left_ankle',
|
|
27
|
+
'right_ankle',
|
|
28
|
+
],
|
|
29
|
+
keypoint_lines: [
|
|
30
|
+
'right_shoulder||left_shoulder',
|
|
31
|
+
'right_hip||left_hip',
|
|
32
|
+
'right_hip||right_shoulder',
|
|
33
|
+
'right_hip||right_knee',
|
|
34
|
+
'right_ankle||right_knee',
|
|
35
|
+
'right_shoulder||right_elbow',
|
|
36
|
+
'right_wrist||right_elbow',
|
|
37
|
+
'left_hip||left_shoulder',
|
|
38
|
+
'left_hip||left_knee',
|
|
39
|
+
'left_ankle||left_knee',
|
|
40
|
+
'left_shoulder||left_elbow',
|
|
41
|
+
'left_wrist||left_elbow',
|
|
42
|
+
],
|
|
43
|
+
keypoint_angles: [],
|
|
44
|
+
angles: { fontColor: '#000000', strokeColor: '#FFC300' },
|
|
45
|
+
circles: {
|
|
46
|
+
circleFillColor: '#010A73',
|
|
47
|
+
circleStrokeColor: '#FFC300',
|
|
48
|
+
strokeWidth: '4',
|
|
49
|
+
radius: '8',
|
|
50
|
+
},
|
|
51
|
+
lines: { lineStrokeColor: '#010A73', strokeWidth: '4' },
|
|
52
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pose-tracker/react-native-pose-estimation-light",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Human pose estimation SDK for React Native (light / online) — MoveNet Lightning via CDN + model URL each session, no bundled weights. iOS & Android (Expo Go). Optional API-key exercise engine.",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"source": "src/index.ts",
|
|
8
|
+
"react-native": "lib/index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"lib",
|
|
11
|
+
"src",
|
|
12
|
+
"!src/backends/webview/poseRuntimeSource.js",
|
|
13
|
+
"ios",
|
|
14
|
+
"PoseTrackerVision.podspec",
|
|
15
|
+
"react-native.config.js",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE",
|
|
18
|
+
"THIRD_PARTY_NOTICES.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "node scripts/sync-sdk-version.mjs && node scripts/embed-pose-runtime.mjs && tsc -p tsconfig.json && node scripts/copy-pose-runtime-source.mjs",
|
|
22
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
23
|
+
"embed:runtime": "node scripts/embed-pose-runtime.mjs",
|
|
24
|
+
"prepack": "npm run build",
|
|
25
|
+
"pack:dry": "npm pack --dry-run"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"human-pose-estimation",
|
|
29
|
+
"pose-estimation",
|
|
30
|
+
"react-native",
|
|
31
|
+
"react-native-pose-estimation",
|
|
32
|
+
"ios",
|
|
33
|
+
"android",
|
|
34
|
+
"expo",
|
|
35
|
+
"expo-go",
|
|
36
|
+
"movenet",
|
|
37
|
+
"computer-vision",
|
|
38
|
+
"fitness",
|
|
39
|
+
"exercise-tracking",
|
|
40
|
+
"keypoints",
|
|
41
|
+
"posetracker",
|
|
42
|
+
"online-ai",
|
|
43
|
+
"light-sdk",
|
|
44
|
+
"webview",
|
|
45
|
+
"sdk"
|
|
46
|
+
],
|
|
47
|
+
"author": {
|
|
48
|
+
"name": "Movelytics SAS",
|
|
49
|
+
"email": "hello@posetracker.com",
|
|
50
|
+
"url": "https://www.posetracker.com"
|
|
51
|
+
},
|
|
52
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
53
|
+
"homepage": "https://github.com/Movelytics/react-native-pose-estimation-light#readme",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/Movelytics/react-native-pose-estimation-light/issues"
|
|
56
|
+
},
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "git+https://github.com/Movelytics/react-native-pose-estimation-light.git"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public"
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"js-sha256": "^0.11.0"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"expo-file-system": ">=15.0.0",
|
|
69
|
+
"react": ">=18.0.0",
|
|
70
|
+
"react-native": ">=0.72.0",
|
|
71
|
+
"react-native-blob-util": ">=0.19.0",
|
|
72
|
+
"react-native-fs": ">=2.20.0",
|
|
73
|
+
"react-native-webview": ">=13.0.0"
|
|
74
|
+
},
|
|
75
|
+
"peerDependenciesMeta": {
|
|
76
|
+
"expo-file-system": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"react-native-fs": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"react-native-blob-util": {
|
|
83
|
+
"optional": true
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"@types/react": "^18.2.0",
|
|
88
|
+
"react": "^18.2.0",
|
|
89
|
+
"react-native": "^0.74.0",
|
|
90
|
+
"typescript": "^5.4.0"
|
|
91
|
+
}
|
|
92
|
+
}
|