deepar 4.0.3 → 4.1.0-alpha-720

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 CHANGED
@@ -209,8 +209,8 @@ To use shoe try-on feature DeepAR needs to initialize foot tracking. All the `fo
209
209
 
210
210
  ```javascript
211
211
  import poseEstimationWasmPath from 'deepar/wasm/libxzimgPoseEstimation.wasm';
212
- import footDetectorPath from 'deepar/models/foot/foot-detector-android.bin'; // or ...-ios.bin
213
- import footTrackerPath from 'deepar/models/foot/foot-tracker-android.bin'; // or ...-ios.bin
212
+ import footDetectorPath from 'deepar/models/foot/foot-detection-96x96x6.bin';
213
+ import footTrackerPath from 'deepar/models/foot/foot-tracker-96x96x18-test.bin'; // or foot-tracker-96x96x13-test.bin
214
214
  import footObjPath from 'deepar/models/foot/foot-model.obj';
215
215
 
216
216
  // ...
package/js/deepar.d.ts CHANGED
@@ -31,6 +31,12 @@ export interface FaceData {
31
31
  */
32
32
  faceRect: number[];
33
33
  }
34
+ export interface FootData {
35
+ /**
36
+ * True if the foot is detected, false otherwise.
37
+ */
38
+ detected: boolean;
39
+ }
34
40
  /**
35
41
  * Functions that gets called by the DeepAR SDK.
36
42
  * Pass them when creating {@link DeepAR} object in {@link DeepARParams.callbacks} object.
@@ -82,10 +88,20 @@ export interface DeepARCallbacks {
82
88
  */
83
89
  onFaceVisibilityChanged?: (visible: boolean) => void;
84
90
  /**
85
- * Passes the information about the detected faces. If this callback is set it will get called every frame.
91
+ * Passes the information about the detected faces. If this callback is set, it will get called every frame when a face is detected.
86
92
  * @param faceDataArray Information about all the tracked faces.
87
93
  */
88
94
  onFaceTracked?: (faceDataArray: FaceData[]) => void;
95
+ /**
96
+ * Called when foot tracking is fully initialized.
97
+ */
98
+ onFootTrackingInitialized?: () => void;
99
+ /**
100
+ * Passes the information about the detected feet. If this callback is set, it will get called every frame when a foot is detected.
101
+ * @param leftFootData Information about the left foot.
102
+ * @param rightFootData Information about the right foot.
103
+ */
104
+ onFeetTracked?: (leftFootData: FootData, rightFootData: FootData) => void;
89
105
  /**
90
106
  * Called when any DeepAR related event happens
91
107
  * @param errorType Type of message.
@@ -124,26 +140,9 @@ export interface DeepARParams {
124
140
  modelPath: string;
125
141
  };
126
142
  /**
127
- * Object containing configuration for DeepAR foot tracking which is used for virtual shoe try on
143
+ * Object containing configuration for DeepAR foot tracking which is used for virtual shoe try on.
128
144
  */
129
- footTrackingConfig?: {
130
- /**
131
- * Path to the pose estimation wasm file, e.g. "/path/to/libPoseEstimation.wasm"
132
- */
133
- poseEstimationWasmPath: string;
134
- /**
135
- * Path to the detector model, e.g. "/path/to/foot-detector-ios.bin"
136
- */
137
- detectorPath: string;
138
- /**
139
- * Path to the tracker model, e.g. "/path/to/foot-tracker-ios.bin"
140
- */
141
- trackerPath: string;
142
- /**
143
- * Path to the foot model object file, e.g. "/path/to/foot-model.obj"
144
- */
145
- objPath: string;
146
- };
145
+ footTrackingConfig?: DeepARFootTrackingConfig;
147
146
  /**
148
147
  * Path to deepar.wasm file. Something like "path/to/deepar.wasm".
149
148
  */
@@ -153,6 +152,28 @@ export interface DeepARParams {
153
152
  */
154
153
  callbacks?: DeepARCallbacks;
155
154
  }
155
+ /**
156
+ * Foot tracking initialization parameters.
157
+ */
158
+ export interface DeepARFootTrackingConfig {
159
+ /**
160
+ * Path to the pose estimation wasm file, e.g. "/path/to/libPoseEstimation.wasm".
161
+ */
162
+ poseEstimationWasmPath: string;
163
+ /**
164
+ * Path to the detector model, e.g. "/path/to/foot-detection-96x96x6.bin".
165
+ */
166
+ detectorPath: string;
167
+ /**
168
+ * Path to the tracker model, e.g. "/path/to/foot-tracker-96x96x18-test.bin".
169
+ * For better performance on older devices, you can use "/path/to/foot-tracker-96x96x13-test.bin".
170
+ */
171
+ trackerPath: string;
172
+ /**
173
+ * Path to the foot model object file, e.g. "/path/to/foot-model.obj".
174
+ */
175
+ objPath: string;
176
+ }
156
177
  /**
157
178
  * Describes the touch/click type.
158
179
  */
@@ -284,6 +305,16 @@ export declare class DeepAR {
284
305
  * @param callback Callback to be called when the download is complete.
285
306
  */
286
307
  downloadFaceTrackingModel(path: string, callback?: () => void): void;
308
+ /**
309
+ * Downloads the foot tracking models and initializes foot tracking.
310
+ * @param options Foot tracking initialization options.
311
+ * @param options.config Foot tracking configuration. It will extend any previously defined foot tracking configuration.
312
+ * @param options.onInitialized Callback that gets called when foot tracking is fully initialized.
313
+ */
314
+ initializeFootTracking(options?: {
315
+ config?: DeepARFootTrackingConfig;
316
+ onInitialized?: () => void;
317
+ }): void;
287
318
  /**
288
319
  * Sets the face tracking model data.
289
320
  * @param byteArray Face tracking model data.
@@ -31,6 +31,12 @@ export interface FaceData {
31
31
  */
32
32
  faceRect: number[];
33
33
  }
34
+ export interface FootData {
35
+ /**
36
+ * True if the foot is detected, false otherwise.
37
+ */
38
+ detected: boolean;
39
+ }
34
40
  /**
35
41
  * Functions that gets called by the DeepAR SDK.
36
42
  * Pass them when creating {@link DeepAR} object in {@link DeepARParams.callbacks} object.
@@ -82,10 +88,20 @@ export interface DeepARCallbacks {
82
88
  */
83
89
  onFaceVisibilityChanged?: (visible: boolean) => void;
84
90
  /**
85
- * Passes the information about the detected faces. If this callback is set it will get called every frame.
91
+ * Passes the information about the detected faces. If this callback is set, it will get called every frame when a face is detected.
86
92
  * @param faceDataArray Information about all the tracked faces.
87
93
  */
88
94
  onFaceTracked?: (faceDataArray: FaceData[]) => void;
95
+ /**
96
+ * Called when foot tracking is fully initialized.
97
+ */
98
+ onFootTrackingInitialized?: () => void;
99
+ /**
100
+ * Passes the information about the detected feet. If this callback is set, it will get called every frame when a foot is detected.
101
+ * @param leftFootData Information about the left foot.
102
+ * @param rightFootData Information about the right foot.
103
+ */
104
+ onFeetTracked?: (leftFootData: FootData, rightFootData: FootData) => void;
89
105
  /**
90
106
  * Called when any DeepAR related event happens
91
107
  * @param errorType Type of message.
@@ -124,26 +140,9 @@ export interface DeepARParams {
124
140
  modelPath: string;
125
141
  };
126
142
  /**
127
- * Object containing configuration for DeepAR foot tracking which is used for virtual shoe try on
143
+ * Object containing configuration for DeepAR foot tracking which is used for virtual shoe try on.
128
144
  */
129
- footTrackingConfig?: {
130
- /**
131
- * Path to the pose estimation wasm file, e.g. "/path/to/libPoseEstimation.wasm"
132
- */
133
- poseEstimationWasmPath: string;
134
- /**
135
- * Path to the detector model, e.g. "/path/to/foot-detector-ios.bin"
136
- */
137
- detectorPath: string;
138
- /**
139
- * Path to the tracker model, e.g. "/path/to/foot-tracker-ios.bin"
140
- */
141
- trackerPath: string;
142
- /**
143
- * Path to the foot model object file, e.g. "/path/to/foot-model.obj"
144
- */
145
- objPath: string;
146
- };
145
+ footTrackingConfig?: DeepARFootTrackingConfig;
147
146
  /**
148
147
  * Path to deepar.wasm file. Something like "path/to/deepar.wasm".
149
148
  */
@@ -153,6 +152,28 @@ export interface DeepARParams {
153
152
  */
154
153
  callbacks?: DeepARCallbacks;
155
154
  }
155
+ /**
156
+ * Foot tracking initialization parameters.
157
+ */
158
+ export interface DeepARFootTrackingConfig {
159
+ /**
160
+ * Path to the pose estimation wasm file, e.g. "/path/to/libPoseEstimation.wasm".
161
+ */
162
+ poseEstimationWasmPath: string;
163
+ /**
164
+ * Path to the detector model, e.g. "/path/to/foot-detection-96x96x6.bin".
165
+ */
166
+ detectorPath: string;
167
+ /**
168
+ * Path to the tracker model, e.g. "/path/to/foot-tracker-96x96x18-test.bin".
169
+ * For better performance on older devices, you can use "/path/to/foot-tracker-96x96x13-test.bin".
170
+ */
171
+ trackerPath: string;
172
+ /**
173
+ * Path to the foot model object file, e.g. "/path/to/foot-model.obj".
174
+ */
175
+ objPath: string;
176
+ }
156
177
  /**
157
178
  * Describes the touch/click type.
158
179
  */
@@ -284,6 +305,16 @@ export declare class DeepAR {
284
305
  * @param callback Callback to be called when the download is complete.
285
306
  */
286
307
  downloadFaceTrackingModel(path: string, callback?: () => void): void;
308
+ /**
309
+ * Downloads the foot tracking models and initializes foot tracking.
310
+ * @param options Foot tracking initialization options.
311
+ * @param options.config Foot tracking configuration. It will extend any previously defined foot tracking configuration.
312
+ * @param options.onInitialized Callback that gets called when foot tracking is fully initialized.
313
+ */
314
+ initializeFootTracking(options?: {
315
+ config?: DeepARFootTrackingConfig;
316
+ onInitialized?: () => void;
317
+ }): void;
287
318
  /**
288
319
  * Sets the face tracking model data.
289
320
  * @param byteArray Face tracking model data.