deepar 5.1.1 → 5.2.0-chromeExtension

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 (44) hide show
  1. package/VERSION.txt +1 -1
  2. package/js/deepar.esm.js +1 -1
  3. package/js/deepar.js +1 -1
  4. package/js/types/DeepAR.d.ts +11 -1
  5. package/js/types/callbacks.d.ts +13 -0
  6. package/js/types/initParams.d.ts +33 -0
  7. package/js/types/version.d.ts +1 -1
  8. package/js/types/wristData.d.ts +13 -0
  9. package/lib/README.md +7 -0
  10. package/lib/VERSION.txt +1 -0
  11. package/lib/js/deepar.esm.js +1 -0
  12. package/lib/js/deepar.js +1 -0
  13. package/lib/js/types/DeepAR.d.ts +332 -0
  14. package/lib/js/types/callbacks.d.ts +63 -0
  15. package/lib/js/types/errors.d.ts +6 -0
  16. package/lib/js/types/faceData.d.ts +33 -0
  17. package/lib/js/types/footData.d.ts +9 -0
  18. package/lib/js/types/index.d.ts +9 -0
  19. package/lib/js/types/initParams.d.ts +157 -0
  20. package/lib/js/types/logType.d.ts +18 -0
  21. package/lib/js/types/scriptingApi.d.ts +107 -0
  22. package/lib/js/types/touchType.d.ts +34 -0
  23. package/lib/js/types/version.d.ts +5 -0
  24. package/lib/js/types/wristData.d.ts +13 -0
  25. package/lib/models/face/models-68-extreme.bin +0 -0
  26. package/lib/models/foot/foot-detection-96x96x6.bin +0 -0
  27. package/lib/models/foot/foot-model.obj +3965 -0
  28. package/lib/models/foot/foot-tracker-96x96x13-test.bin +0 -0
  29. package/lib/models/foot/foot-tracker-96x96x18-test.bin +0 -0
  30. package/lib/models/segmentation/segmentation-160x160-opt.bin +0 -0
  31. package/lib/models/wrist/wrist-base-2.obj +3815 -0
  32. package/lib/models/wrist/wrist-det-9.bin +0 -0
  33. package/lib/models/wrist/wrist-track.bin +0 -0
  34. package/lib/wasm/deepar.wasm +0 -0
  35. package/lib/wasm/libxzimgPoseEstimation.wasm +0 -0
  36. package/lib/wasm/tfjs-backend-wasm-simd.wasm +0 -0
  37. package/lib/wasm/tfjs-backend-wasm-threaded-simd.wasm +0 -0
  38. package/lib/wasm/tfjs-backend-wasm.wasm +0 -0
  39. package/models/wrist/wrist-base-2.obj +3815 -0
  40. package/models/wrist/wrist-det-9.bin +0 -0
  41. package/models/wrist/wrist-track.bin +0 -0
  42. package/package.json +1 -1
  43. package/wasm/deepar.wasm +0 -0
  44. package/wasm/libxzimgPoseEstimation.wasm +0 -0
@@ -0,0 +1,332 @@
1
+ import { ARTouchInfo } from "./touchType";
2
+ import { DeepARCallbacks } from "./callbacks";
3
+ import { DeepARParams } from "./initParams";
4
+ import { LogType } from "./logType";
5
+ import { ScriptingAPI } from "./scriptingApi";
6
+ /**
7
+ * Initialize the DeepAR SDK.<br><br>
8
+ * @param params Initialization parameters.
9
+ * @example
10
+ * import * as deepar from 'deepar';
11
+ *
12
+ * let deepAR = deepar.initialize({
13
+ * licenseKey: 'your_license_key_here',
14
+ * canvas: document.getElementById('deepar-canvas')
15
+ * });
16
+ */
17
+ export declare function initialize(params: DeepARParams): Promise<DeepAR>;
18
+ /**
19
+ * Main class for interacting with DeepAR SDK. To get a DeepAR object call {@link initialize}.
20
+ */
21
+ export declare class DeepAR {
22
+ /**
23
+ * Emscripten module object. Contains all the exposed C/C++ API. Used for interacting with the native SDK.
24
+ * @private
25
+ */
26
+ private module;
27
+ /**
28
+ * Callbacks property is used to add/remove/change callbacks called by the DeepAR SDK. See list of all callbacks at {@link DeepARCallbacks}. <br><br>
29
+ * Example: To add/change certain callback:
30
+ * ```javascript
31
+ * let deepAR = deepar.initialize({...});
32
+ * deepAR.callbacks.onFaceVisibilityChanged = () => {
33
+ * // do something
34
+ * };
35
+ * ```
36
+ *
37
+ * To remove certain callback:
38
+ * ```javascript
39
+ * deepAR.callbacks.onFaceTracked = undefined;
40
+ * ```
41
+ */
42
+ callbacks: DeepARCallbacks;
43
+ /**
44
+ * Scripting API property used to access all the scripting interop methods.
45
+ *
46
+ * @example
47
+ * let scriptingVariable = deepAR.ScriptingAPI.getStringVar('variableName');
48
+ */
49
+ ScriptingAPI: ScriptingAPI;
50
+ /**
51
+ * @internal
52
+ * @param module
53
+ */
54
+ constructor(module: any);
55
+ /**
56
+ * Switch the AR effect for preview.
57
+ *
58
+ * @param effect A path (URL) to the AR effect file or an ArrayBuffer object of an already fetched AR effect file.
59
+ * @param effectOptions Effect options.
60
+ * @param effectOptions.slot Default value is "DEFAULT_SLOT" if slot is not given. Slot is a container for a given AR effect. When replacing the already loaded AR effect, call switchEffect with that same slot. To remove AR effect entirely, call {@link clearEffect} with the same slot.
61
+ * @param effectOptions.face If AR effect is face filter, select to which face to attach it to. The value should be between 0 and 3. Default value is 0.
62
+ *
63
+ * @throws {@link errors.SwitchEffectCanceled} If the switch effect is canceled by something.
64
+ *
65
+ * @example
66
+ * // Switch filter 1.
67
+ * await deepAR.switchEffect('url/path/to/filter1');
68
+ * // Later switch fo filter 2.
69
+ * await deepAR.switchEffect('url/path/to/filter2');
70
+ *
71
+ * // Remove the current filter.
72
+ * deepAR.clearEffect();
73
+ *
74
+ * // Put two filters at the same time.
75
+ * await deepAR.switchEffect('url/path/to/backgroundReplacement', {slot: 'background'});
76
+ * await deepAR.switchEffect('url/path/to/glasses', {slot: 'faceMask'});
77
+ * // Replace the glasses filter.
78
+ * await deepAR.switchEffect('url/path/to/glasses2', {slot: 'faceMask'});
79
+ * // Remove those filters.
80
+ * deepAR.clearEffect('background');
81
+ * deepAR.clearEffect('faceMask');
82
+ *
83
+ * // Load filters for two people.
84
+ * await deepAR.switchEffect('url/path/to/faceMask1', {face: 0, slot: 'mask1'});
85
+ * await deepAR.switchEffect('url/path/to/faceMask2', {face: 1, slot: 'mask2'});
86
+ * // Clear effect for the second person.
87
+ * deepAR.clearEffect('mask2');
88
+ */
89
+ switchEffect(effect: string | ArrayBuffer, effectOptions?: {
90
+ slot?: string;
91
+ face?: number;
92
+ }): Promise<void>;
93
+ /**
94
+ * Clears the given slot of any loaded effects.
95
+ * @param slot The effect slot name. Default is "DEFAULT_SLOT".
96
+ */
97
+ clearEffect(slot?: string): void;
98
+ /**
99
+ * Captures a screenshot of the current screen.
100
+ * @returns <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs">Data URL</a> promise containing the image in <code>data:image/png</code> format.
101
+ */
102
+ takeScreenshot(): Promise<string>;
103
+ /**
104
+ * Starts video recording of the canvas.
105
+ * @param options Parameters that specify the format of recorded videos
106
+ * @param options.mimeType A MIME type specifying the format for the resulting video, such as `video/webm` or `video/mp4`. Corresponds to the MIME type used by <a href="https://developer.mozilla.org/en-US/docs/Web/API/Blob">Blob</a>objects and <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder">MediaRecorder</a>from the MediaStream Recording API. Note that `video/mp4` may not be supported in all browsers.
107
+ */
108
+ startVideoRecording(options?: {
109
+ mimeType?: string;
110
+ }): void;
111
+ /**
112
+ * Stops the video recording and returns a video blob.
113
+ * @returns A promise resolving to Blob of a video.
114
+ */
115
+ finishVideoRecording(): Promise<Blob>;
116
+ /**
117
+ * Starts the camera preview. By default, the camera will be user facing. The returned promise will resolve after the camera starts
118
+ * or it will reject if camera permission was denied.
119
+ * @param cameraOptions Camera options.
120
+ * @param cameraOptions.mirror Mirror the camera horizontally. True by default.
121
+ * @param cameraOptions.mediaStreamConstraints Options passed to MediaDevices.getUserMedia(). The default is the user facing camera.
122
+ * @param cameraOptions.cameraPermissionAsked Callback called when camera permission is asked.
123
+ * @param cameraOptions.cameraPermissionGranted Callback called when camera permission is granted.
124
+ */
125
+ startCamera(cameraOptions?: {
126
+ mirror?: boolean;
127
+ mediaStreamConstraints?: MediaStreamConstraints;
128
+ cameraPermissionAsked?: () => void;
129
+ cameraPermissionGranted?: () => void;
130
+ }): Promise<void>;
131
+ /**
132
+ * Stops the camera preview.
133
+ */
134
+ stopCamera(): void;
135
+ /**
136
+ * Stops the camera preview or custom video preview set by {@link setVideoElement}.
137
+ */
138
+ stopVideo(): void;
139
+ /**
140
+ * Used to pass the HTMLVideoElement to the DeepAR SDK. The SDK will use this video as camera source. This method should be used instead of {@link DeepAR.startCamera} when you want to handle getUserMedia outside the SDK or you need to apply the masks to any video stream.
141
+ * To disable automatic camera preview by DeepAR:
142
+ * ```js
143
+ * const deepAR = deepar.initialize({
144
+ * // ...
145
+ * additionalOptions: {
146
+ * cameraConfig: {
147
+ * disableDefaultCamera: true
148
+ * }
149
+ * }
150
+ * });
151
+ * ```
152
+ * @param videoElement Video element.
153
+ * @param mirror Mirror the video horizontally.
154
+ */
155
+ setVideoElement(videoElement: HTMLVideoElement, mirror: boolean): void;
156
+ /**
157
+ * Shutdown the DeepAR SDK and release all resources associated with it. It is invalid to call any function from this {@link DeepAR} object after shutdown.
158
+ * After shutdown call, it is possible to call {@link initialize} again.
159
+ */
160
+ shutdown(): void;
161
+ /**
162
+ * Feed RGBA image to DeepAR as input instead of camera or video. Used for processing single image. Can be used instead of {@link startCamera} or {@link setVideoElement}.
163
+ * Can be called in a loop.
164
+ * @param frame Image.
165
+ * @param width Width of the image.
166
+ * @param height Height of the image.
167
+ * @param mirror Mirror frame horizontally.
168
+ */
169
+ processFrame(frame: Uint8Array, width: number, height: number, mirror: boolean): void;
170
+ /**
171
+ * If you want to apply DeepAR processing on a single image instead of a camera stream use this method. Can be used instead of {@link startCamera} or {@link DeepAR.setVideoElement}. See example usage <a href="https://github.com/DeepARSDK/photoedit-web-js">here</a>.
172
+ * @param image
173
+ */
174
+ processImage(image: HTMLImageElement): void;
175
+ /**
176
+ * Pauses the DeepAR processing and rendering on canvas.
177
+ * @param isPause If true, DeepAR will pause. Otherwise, it will resume processing and rendering.
178
+ */
179
+ setPaused(isPause: boolean): void;
180
+ /**
181
+ * Changes a node or component bool parameter of the currently loaded effect. For more details about changeParameter API read our docs <a href="https://docs.deepar.ai/guides-and-tutorials/changing-filter-parameters-from-code">here</a>.
182
+ * @param gameObject The name of the node from DeepAR Studio. If multiple nodes share the same name, only the first one will be affected.
183
+ * @param component The name of the component. If the name of the component is null or an empty string, the node itself will be affected.
184
+ * @param parameter The name of the parameter.
185
+ * @param value New parameter value.
186
+ */
187
+ changeParameterFloat(gameObject: string, component: string, parameter: string, value: number): void;
188
+ /**
189
+ * Changes a node or component float parameter of the currently loaded effect. For more details about changeParameter API read our docs <a href="https://docs.deepar.ai/guides-and-tutorials/changing-filter-parameters-from-code">here</a>.
190
+ * @param gameObject The name of the node from DeepAR Studio. If multiple nodes share the same name, only the first one will be affected.
191
+ * @param component The name of the component. If the name of the component is null or an empty string, the node itself will be affected.
192
+ * @param parameter The name of the parameter.
193
+ * @param value New parameter value.
194
+ */
195
+ changeParameterBool(gameObject: string, component: string, parameter: string, value: boolean): void;
196
+ /**
197
+ * Changes a node or component vector parameter of the currently loaded effect. For more details about changeParameter API read our docs <a href="https://docs.deepar.ai/guides-and-tutorials/changing-filter-parameters-from-code">here</a>.
198
+ * @param gameObject The name of the node from DeepAR Studio. If multiple nodes share the same name, only the first one will be affected.
199
+ * @param component The name of the component. If the name of the component is null or an empty string, the node itself will be affected.
200
+ * @param parameter The name of the parameter.
201
+ * @param x X component of the new parameter vector.
202
+ * @param y Y component of the new parameter vector.
203
+ * @param z Z component of the new parameter vector.
204
+ * @param w W component of the new parameter vector.
205
+ */
206
+ changeParameterVector(gameObject: string, component: string, parameter: string, x: number, y: number, z: number, w: number): void;
207
+ /**
208
+ * Changes a node or component texture parameter of the currently loaded effect. For more details about changeParameter API read our docs <a href="https://docs.deepar.ai/guides-and-tutorials/changing-filter-parameters-from-code">here</a>.
209
+ * @param gameObject The name of the node from DeepAR Studio. If multiple nodes share the same name, only the first one will be affected.
210
+ * @param component The name of the component. If the name of the component is null or an empty string, the node itself will be affected.
211
+ * @param parameter The name of the parameter.
212
+ * @param textureUrl Url of the image that is going to be used as texture.
213
+ */
214
+ changeParameterTexture(gameObject: string, component: string, parameter: string, textureUrl: string): void;
215
+ /**
216
+ * This method allows the user to fire a custom animation trigger for model animations from code. To fire a custom trigger,
217
+ * the trigger string must match the custom trigger set in the Studio when creating the effect. Read more <a href="https://help.deepar.ai/en/articles/4354740-animations-tutorial-fbx-model-animations">here</a>.
218
+ * @param trigger The name of the trigger.
219
+ */
220
+ fireTrigger(trigger: string): void;
221
+ /**
222
+ * Informs DeepAR that the specified touch event occurred.
223
+ * @param touchInfo Touch event information.
224
+ */
225
+ touchOccurred(touchInfo: ARTouchInfo): void;
226
+ /**
227
+ * Change face detection sensitivity
228
+ * @param sensitivity 0 .. 5 (0 is fast, 4,5 is slow but allows to find smaller faces)
229
+ */
230
+ setFaceDetectionSensitivity(sensitivity: number): void;
231
+ /**
232
+ * Enable/disable forced rendering on the canvas. It is useful to enable offscreen rendering in scenarios when the browser
233
+ * does not call requestAnimationFrame() function. DeepAR internally uses requestAnimationFrame() for the rendering loop.
234
+ * For example, when the browser tab is not focused, the browser will not call requestAnimationFrame() and DeepAR will not
235
+ * render. If offscreen rendering is enabled, DeepAR will use its internal timer for the rendering loop. Note that offscreen
236
+ * rendering enabled will not have as good results in terms of FPS compared to offscreen rendering disabled. <br><br>
237
+ *
238
+ * If you need to use offscreen rendering. The best practice is to enable it only when needed - like when the browser tab is not focused.
239
+ * Otherwise, it is best to always disable offscreen rendering.
240
+ * @param enable True - DeepAR will use its internal timer for the rendering loop. Rendering will work even when tab is not focused. False - DeepAR will use requestAnimationFrame() for the rendering loop.
241
+ */
242
+ setOffscreenRenderingEnabled(enable: boolean): void;
243
+ /**
244
+ * Set the FPS of DeepAR rendering.
245
+ * @param fps New FPS.
246
+ */
247
+ setFps(fps: number): void;
248
+ /**
249
+ * Initialize foot tracking.<br><br>
250
+ *
251
+ * Foot tracking is usually lazy loaded on demand when filter loaded with {@link switchEffect} requires it.
252
+ * But this method will start loading the foot tracking immediately.
253
+ * To start initializing foot tracking as soon as possible pass "footInit" hint in the {@link initialize} function (see {@link DeepARParams}). <br><br>
254
+ *
255
+ * If the foot tracking is already initialized it will do nothing.
256
+ * To check if foot tracking is initialized call {@link isFootTrackingInitialized} or wait {@link DeepARCallbacks.onFootTrackingInitialized} callback.
257
+ */
258
+ initializeFootTracking(): void;
259
+ /**
260
+ * Check weather the foot tracking is initialized.
261
+ */
262
+ isFootTrackingInitialized(): boolean;
263
+ /**
264
+ * Initialize segmentation.<br><br>
265
+ *
266
+ * Segmentation is usually lazy loaded on demand when filter loaded with {@link switchEffect} requires it.
267
+ * But this method will start loading the segmentation immediately.
268
+ * To start initializing segmentation as soon as possible pass "segmentationInit" hint in the {@link initialize} function (see {@link DeepARParams}). <br><br>
269
+ *
270
+ * If the segmentation is already initialized it will do nothing.
271
+ * To check if segmentation is initialized call {@link isSegmentationInitialized} or wait {@link DeepARCallbacks.onSegmentationInitialized} callback.
272
+ */
273
+ initializeSegmentation(): void;
274
+ /**
275
+ * Check weather the segmentation is initialized.
276
+ */
277
+ isSegmentationInitialized(): boolean;
278
+ /**
279
+ * Check weather the wrist tracking is initialized.
280
+ */
281
+ isWristTrackingInitialized(): boolean;
282
+ /**
283
+ * Display profiling metrics on preview.
284
+ * @param enabled
285
+ */
286
+ showStats(enabled: boolean): void;
287
+ /**
288
+ * Enable or disable global physics simulation.
289
+ * @param enabled
290
+ */
291
+ simulatePhysics(enabled: boolean): void;
292
+ /**
293
+ * Moves the selected game object from its current position in a tree and sets it as a direct child of a target game object.
294
+ * This is equivalent to moving around a node in the node hierarchy in the DeepAR Studio.
295
+ * @param selectedGameObject Node to move.
296
+ * @param targetGameObject New node parent.
297
+ */
298
+ moveGameObject(selectedGameObject: string, targetGameObject: string): void;
299
+ /** INTERNAL API **/
300
+ /**
301
+ * @internal
302
+ * @param enable
303
+ */
304
+ enableAutoframing(enable: boolean): void;
305
+ /**
306
+ * @internal
307
+ * Returns all the messages pushed to the console log buffer and empties
308
+ * the buffer.
309
+ * @returns All the messages from console log buffer.
310
+ */
311
+ getConsoleLogs(): any;
312
+ /**
313
+ * @internal
314
+ * Pushes message to the console log buffer.
315
+ * @param message Message to be pushed to the console log buffer.
316
+ * @param logType Logging type.
317
+ * @returns true if the message was successfully pushed, false otherwise
318
+ */
319
+ pushConsoleLog(message: string, logType: LogType): boolean;
320
+ /**
321
+ * @internal
322
+ * Display physics colliders preview on screen.
323
+ * @param enabled
324
+ */
325
+ showColliders(enabled: boolean): void;
326
+ /**
327
+ * Sets the preview zoom.
328
+ *
329
+ * @param zoomLevel Floating point number determining how much to zoom in. Value <= 1 will disable zoom. Example, value 2.0 puts 2x zoom.
330
+ */
331
+ setZoom(zoomLevel: number): void;
332
+ }
@@ -0,0 +1,63 @@
1
+ import { FaceData } from "./faceData";
2
+ import { FootData } from "./footData";
3
+ import { WristData } from "./wristData";
4
+ /**
5
+ * Callbacks from DeepAR notifying events.
6
+ * Register callbacks with {@link DeepAR.callbacks}.
7
+ */
8
+ export interface DeepARCallbacks {
9
+ /**
10
+ * Called whenever the face enters or exits the camera field of view. <br>
11
+ * NOTE: This callback is only called when the SDK does face tracking. For example, you laded some effect that uses face tracking (most of them do). But if no effect is loaded this callback will not get called because the SDK is not performing face tracking.
12
+ * @param visible True if the face is visible on the camera, false otherwise.
13
+ */
14
+ onFaceVisibilityChanged?: (visible: boolean) => void;
15
+ /**
16
+ * Passes the information about the detected faces. If this callback is set, it will get called every frame.
17
+ * NOTE: This callback is only called when the SDK does face tracking. For example, you laded some effect that uses face tracking (most of them do). But if no effect is loaded this callback will not get called because the SDK is not performing face tracking.
18
+ * @param faceDataArray Information about all the tracked faces.
19
+ */
20
+ onFaceTracked?: (faceDataArray: FaceData[]) => void;
21
+ /**
22
+ * Passes the information about the detected feet. If this callback is set, it will get called every frame.
23
+ * NOTE: This callback is only called when the SDK does foot tracking. For example, you laded some effect that uses foot tracking (shoe-try-on effects). But if no effect is loaded this callback will not get called because the SDK is not performing foot tracking.
24
+ * @param leftFootData Information about the left foot.
25
+ * @param rightFootData Information about the right foot.
26
+ */
27
+ onFeetTracked?: (leftFootData: FootData, rightFootData: FootData) => void;
28
+ /**
29
+ * Passes the information about the detected wrist. If this callback is set, it will get called every frame.
30
+ * NOTE: This callback is only called when the SDK does wrist tracking. For example, you laded some effect that uses wrist tracking (watch-try-on effects). But if no effect is loaded this callback will not get called because the SDK is not performing wrist tracking.
31
+ * @param wristData Information about the wrist.
32
+ */
33
+ onWristTracked?: (wristData: WristData) => void;
34
+ /**
35
+ * Called when foot tracking is fully initialized.
36
+ * Be sure to check {@link DeepAR.isFootTrackingInitialized} before setting this callback.
37
+ * Because this callback is called only once. So if you set this callback after the foot tracking is initialized, it will not be called again.
38
+ */
39
+ onFootTrackingInitialized?: () => void;
40
+ /**
41
+ * Called when segmentation is fully initialized.
42
+ * Be sure to check {@link DeepAR.isSegmentationInitialized} before setting this callback.
43
+ * Because this callback is called only once. So if you set this callback after the segmentation is initialized, it will not be called again.
44
+ */
45
+ onSegmentationInitialized?: () => void;
46
+ /**
47
+ * Called when wrist tracking is fully initialized.
48
+ * Be sure to check {@link DeepAR.isWristTrackingInitialized} before setting this callback.
49
+ * Because this callback is called only once. So if you set this callback after the wrist tracking is initialized, it will not be called again.
50
+ */
51
+ onWristTrackingInitialized?: () => void;
52
+ /**
53
+ * Called when the animation player transitions to a new state.
54
+ * @param newState Name of the new state that is being transitioned to.
55
+ */
56
+ onAnimationTransitionedToState?: (newState: string) => void;
57
+ /**
58
+ * An internal callback called on every render().
59
+ * @param canvas A canvas containing input camera image that DeepAR used for rendering/tracking.
60
+ * @internal
61
+ */
62
+ __deeparRendered?: (canvas: HTMLCanvasElement) => void;
63
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Thrown when the switch effect is canceled before it successfully finishes.
3
+ */
4
+ export declare class SwitchEffectCanceled extends Error {
5
+ constructor(message?: string);
6
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Information about the face being tracked. FaceData object is constructed and passed in the {@link DeepARCallbacks.onFaceTracked} callback.
3
+ */
4
+ export interface FaceData {
5
+ /**
6
+ * True if the face is detected, false otherwise.
7
+ */
8
+ detected: boolean;
9
+ /**
10
+ * Array of 3 floats containing (x, y, z) position (translation) of the face in 3D space.
11
+ */
12
+ translation: number[];
13
+ /**
14
+ * Array of 3 floats containing (x, y, z) rotation of the face in 3D space.
15
+ */
16
+ rotation: number[];
17
+ /**
18
+ * Array of 16 floats containing 4x4 matrix representing translation and rotation of the face in 3D space.
19
+ */
20
+ poseMatrix: number[];
21
+ /**
22
+ * Array of 63*3 floats containing (x, y, z) positions of the 3D face landmarks. Read more <a href="https://help.deepar.ai/en/articles/4351347-deepar-reference-tracking-models">here</a>.
23
+ */
24
+ landmarks: number[];
25
+ /**
26
+ * Array of 63*2 floats containing (x, y) positions of the 2D face landmarks in screen space. Usually more precise than 3D points but no estimation for z translation. Read more here about feature points. Read more <a href="https://help.deepar.ai/en/articles/4351347-deepar-reference-tracking-models">here</a>.
27
+ */
28
+ landmarks2d: number[];
29
+ /**
30
+ * Array of 4 floats. Rectangle (x, y, width, height) containing the face in screen coordinates.
31
+ */
32
+ faceRect: number[];
33
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Information about the feet being tracked. FootData object is constructed and passed in the {@link DeepARCallbacks.onFeetTracked} callback.
3
+ */
4
+ export interface FootData {
5
+ /**
6
+ * True if the foot is detected, false otherwise.
7
+ */
8
+ detected: boolean;
9
+ }
@@ -0,0 +1,9 @@
1
+ export * from './version';
2
+ export * from './DeepAR';
3
+ export * from './initParams';
4
+ export * from './callbacks';
5
+ export * from './faceData';
6
+ export * from './footData';
7
+ export * from './scriptingApi';
8
+ export * as errors from './errors';
9
+ export * from './touchType';
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Parameters for the initialization of {@link DeepAR} object.
3
+ */
4
+ export interface DeepARParams {
5
+ /**
6
+ * License key created on <a href="https://developer.deepar.ai/">DeepAR developer portal</a> for your web app.
7
+ */
8
+ licenseKey: string;
9
+ /**
10
+ * Canvas element where DeepAR will render the camera and effects/filters.
11
+ */
12
+ canvas: HTMLCanvasElement;
13
+ /**
14
+ * The URL of a DeepAR effect file. This effect will be applied when DeepAR is initialized.
15
+ * This parameter is optional. You can always later switch to a different effect with {@link DeepAR.switchEffect}.
16
+ */
17
+ effect?: string;
18
+ /**
19
+ * Path to the root directory of the DeepAR SDK. This path will be used to locate and download all the additional needed files like ML models and wasm files.
20
+ * By default, this points to the JsDelivr CDN. For example "https://cdn.jsdelivr.net/npm/deepar@5.0.0/".<br>
21
+ *
22
+ * If you want to host the DeepAR SDK yourself set the path to it here. It is recommended to host DeepAR SDK on your own since then you can use compressions like gzip and brotli on the files.
23
+ *
24
+ * > ⚠️ <b>Be sure that the version of DeepAR js file and the root SDK path match!</b>
25
+ *
26
+ * DeepAR SDK can be hosted on any other server, but be sure not to change the directory and file structure of DeepAR SDK when hosing it.<br>
27
+ *
28
+ * To configure usage of non-default ML models, define them in the {@link additionalOptions}.
29
+ */
30
+ rootPath?: string;
31
+ /**
32
+ * Additional DeepAR options.
33
+ */
34
+ additionalOptions?: {
35
+ /**
36
+ * Camera options. DeepAR will use the camera by default.
37
+ */
38
+ cameraConfig?: {
39
+ /**
40
+ * If true, DeepAR will not use camera preview by default and all the other options here are ignored in that case. You can use your own camera/video by calling {@link DeepAR.setVideoElement} or start the camera at any time by calling {@link DeepAR.startCamera}
41
+ */
42
+ disableDefaultCamera?: boolean;
43
+ /**
44
+ * Can be "user" or "environment". User will be a front facing camera on mobile devices, while environment will be the back facing camera. Default is "user".
45
+ */
46
+ facingMode?: string;
47
+ /**
48
+ * Called when the camera permission is asked.
49
+ */
50
+ cameraPermissionAsked?: () => void;
51
+ /**
52
+ * Called when the camera permission is granted.
53
+ */
54
+ cameraPermissionGranted?: () => void;
55
+ };
56
+ /**
57
+ * Provide a hint or hints to DeepAR to optimize the SDK in some scenarios. <br><br>
58
+ * Available hints:
59
+ * <ul>
60
+ * <li><b>faceModelsPredownload</b> - Will download the face models as soon as possible.</li>
61
+ * <li><b>segmentationModelsPredownload</b> - Will download the segmentation models as soon as possible. Note - it will not try to initialize segmentation. Segmentation will be lazy loaded when needed.</li>
62
+ * <li><b>footModelsPredownload</b> - Will download the foot models as soon as possible. Note - it will not try to initialize foot tracking. Foot tracking will be lazy loaded when needed.</li>
63
+ * <li><b>segmentationInit</b> - Will initialize segmentation as soon as possible. Without this hint segmentation is lazy loaded when some segmentation effect is loaded.</li>
64
+ * <li><b>footInit</b> - Will initialize foot tracking as soon as possible. Without this hint foot tracking is lazy loaded when some foot tracking effect is loaded.</li>
65
+ * </ul>
66
+ */
67
+ hint?: string | string[];
68
+ /**
69
+ * Face tracking module path and options.
70
+ */
71
+ faceTrackingConfig?: {
72
+ /**
73
+ * Path to the face tracking model. Something like "path/to/deepar/models/face/models-68-extreme.bin".
74
+ */
75
+ modelPath: string;
76
+ };
77
+ /**
78
+ * Segmentation module path and options.
79
+ */
80
+ segmentationConfig?: {
81
+ /**
82
+ * Path to the segmentation model. Something like "path/to/deepar/models/segmentation/segmentation-192x192.bin".
83
+ */
84
+ modelPath: string;
85
+ };
86
+ /**
87
+ * Foot tracking module paths and options.
88
+ */
89
+ footTrackingConfig?: {
90
+ /**
91
+ * Path to the pose libPoseEstimation.wasm file, e.g. "/path/to/deepar/wasm/libPoseEstimation.wasm".
92
+ */
93
+ poseEstimationWasmPath?: string;
94
+ /**
95
+ * Path to the detector model, e.g. "/path/to/deepar/models/foot/foot-detector.bin".
96
+ */
97
+ detectorPath?: string;
98
+ /**
99
+ * Path to the tracker model, e.g. "/path/to/deepar/models/foot/foot-tracker.bin".
100
+ */
101
+ trackerPath?: string;
102
+ /**
103
+ * Path to the foot model object file, e.g. "/path/to/deepar/models/foot/foot-model.obj".
104
+ */
105
+ objPath?: string;
106
+ /**
107
+ * Path to tfjs-backend-wasm.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm.wasm"
108
+ */
109
+ tfjsBackendWasmPath?: string;
110
+ /**
111
+ * Path to tfjs-backend-wasm-simd.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm-simd.wasm"
112
+ */
113
+ tfjsBackendWasmSimdPath?: string;
114
+ /**
115
+ * Path to tfjs-backend-wasm-threaded-simd.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm-threaded-simd.wasm"
116
+ */
117
+ tfjsBackendWasmThreadedSimdPath?: string;
118
+ };
119
+ /**
120
+ * Foot tracking module paths and options.
121
+ */
122
+ wristTrackingConfig?: {
123
+ /**
124
+ * Path to the pose libPoseEstimation.wasm file, e.g. "/path/to/deepar/wasm/libPoseEstimation.wasm".
125
+ */
126
+ poseEstimationWasmPath?: string;
127
+ /**
128
+ * Path to the detector model, e.g. "/path/to/deepar/models/foot/foot-detector.bin".
129
+ */
130
+ detectorPath?: string;
131
+ /**
132
+ * Path to the tracker model, e.g. "/path/to/deepar/models/foot/foot-tracker.bin".
133
+ */
134
+ trackerPath?: string;
135
+ /**
136
+ * Path to the foot model object file, e.g. "/path/to/deepar/models/foot/foot-model.obj".
137
+ */
138
+ objPath?: string;
139
+ /**
140
+ * Path to tfjs-backend-wasm.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm.wasm"
141
+ */
142
+ tfjsBackendWasmPath?: string;
143
+ /**
144
+ * Path to tfjs-backend-wasm-simd.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm-simd.wasm"
145
+ */
146
+ tfjsBackendWasmSimdPath?: string;
147
+ /**
148
+ * Path to tfjs-backend-wasm-threaded-simd.wasm file, e.g. "path/to/deepar/wasm/tfjs-backend-wasm-threaded-simd.wasm"
149
+ */
150
+ tfjsBackendWasmThreadedSimdPath?: string;
151
+ };
152
+ /**
153
+ * Path to deepar.wasm file. Something like "/path/to/deepar/wasm/deepar.wasm".
154
+ */
155
+ deeparWasmPath?: string;
156
+ };
157
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @internal
3
+ * Enum that defines possible types of logging messages.
4
+ */
5
+ export declare enum LogType {
6
+ /**
7
+ * Information logging message.
8
+ */
9
+ INFO = 1,
10
+ /**
11
+ * Warning logging message.
12
+ */
13
+ WARNING = 2,
14
+ /**
15
+ * Error logging message.
16
+ */
17
+ ERROR = 3
18
+ }