deepar 5.4.2-chromeExtension → 5.4.2

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 (51) 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/version.d.ts +1 -1
  5. package/package.json +1 -1
  6. package/wasm/deepar.wasm +0 -0
  7. package/lib/LICENSE +0 -1
  8. package/lib/README.md +0 -326
  9. package/lib/VERSION.txt +0 -1
  10. package/lib/effects/background_blur.deepar +0 -0
  11. package/lib/effects/background_replacement.deepar +0 -0
  12. package/lib/js/deepar.esm.js +0 -1
  13. package/lib/js/deepar.js +0 -1
  14. package/lib/js/types/DeepAR.d.ts +0 -387
  15. package/lib/js/types/callbacks.d.ts +0 -64
  16. package/lib/js/types/canvasHelper.d.ts +0 -18
  17. package/lib/js/types/canvasTouchHelper.d.ts +0 -13
  18. package/lib/js/types/errors.d.ts +0 -6
  19. package/lib/js/types/faceData.d.ts +0 -33
  20. package/lib/js/types/footData.d.ts +0 -9
  21. package/lib/js/types/index.d.ts +0 -10
  22. package/lib/js/types/initParams.d.ts +0 -236
  23. package/lib/js/types/logType.d.ts +0 -18
  24. package/lib/js/types/mediaRecorderVideoRecording.d.ts +0 -10
  25. package/lib/js/types/scriptingApi.d.ts +0 -107
  26. package/lib/js/types/touchType.d.ts +0 -34
  27. package/lib/js/types/version.d.ts +0 -5
  28. package/lib/js/types/webCodecsVideoRecording.d.ts +0 -11
  29. package/lib/js/types/wristData.d.ts +0 -13
  30. package/lib/mediaPipe/segmentation/models/selfie_segmenter.tflite +0 -0
  31. package/lib/mediaPipe/segmentation/models/selfie_segmenter_landscape.tflite +0 -0
  32. package/lib/mediaPipe/segmentation/wasm/vision_wasm_internal.js +0 -22
  33. package/lib/mediaPipe/segmentation/wasm/vision_wasm_internal.wasm +0 -0
  34. package/lib/mediaPipe/segmentation/wasm/vision_wasm_nosimd_internal.js +0 -22
  35. package/lib/mediaPipe/segmentation/wasm/vision_wasm_nosimd_internal.wasm +0 -0
  36. package/lib/models/face/models-68-extreme.bin +0 -0
  37. package/lib/models/face-cnn/face-det.bin +0 -0
  38. package/lib/models/face-cnn/face-track-19.bin +0 -0
  39. package/lib/models/foot/foot-detection-96x96x6.bin +0 -0
  40. package/lib/models/foot/foot-model.obj +0 -3965
  41. package/lib/models/foot/foot-tracker-96x96x13-test.bin +0 -0
  42. package/lib/models/foot/foot-tracker-96x96x18-test.bin +0 -0
  43. package/lib/models/segmentation/segmentation-160x160-opt.bin +0 -0
  44. package/lib/models/wrist/wrist-base-2.obj +0 -3815
  45. package/lib/models/wrist/wrist-det-9.bin +0 -0
  46. package/lib/models/wrist/wrist-track.bin +0 -0
  47. package/lib/wasm/deepar.wasm +0 -0
  48. package/lib/wasm/libxzimgPoseEstimation.wasm +0 -0
  49. package/lib/wasm/tfjs-backend-wasm-simd.wasm +0 -0
  50. package/lib/wasm/tfjs-backend-wasm-threaded-simd.wasm +0 -0
  51. package/lib/wasm/tfjs-backend-wasm.wasm +0 -0
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * DeepAR Web SDK version.
3
3
  */
4
- declare const version = "5.4.2-chromeExtension";
4
+ declare const version = "5.4.2";
5
5
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepar",
3
- "version": "5.4.2-chromeExtension",
3
+ "version": "5.4.2",
4
4
  "description": "The official DeepAR Web SDK",
5
5
  "main": "js/deepar.esm.js",
6
6
  "jsdelivr": "js/deepar.js",
package/wasm/deepar.wasm CHANGED
Binary file
package/lib/LICENSE DELETED
@@ -1 +0,0 @@
1
- Please see: https://developer.deepar.ai/customer-agreement
package/lib/README.md DELETED
@@ -1,326 +0,0 @@
1
- DeepAR Web is an augmented reality SDK
2
- that allows users to integrate advanced, Snapchat-like
3
- face lenses in the browser environment.
4
-
5
- DeepAR Web supports:
6
- - Glasses try-on.
7
- - Face filters and masks.
8
- - Background replacement.
9
- - Background blur.
10
- - Shoe try-on.
11
- - AR mini-games.
12
-
13
- ## Documentation
14
-
15
- - Visit official DeepAR docs for Web SDK here https://docs.deepar.ai/category/deepar-sdk-for-web.
16
- - See the official example here: https://github.com/DeepARSDK/quickstart-web-js-npm
17
- - Set up and web ad with DeepAR: https://github.com/DeepARSDK/quickstart-web-ad
18
-
19
- ## License key
20
-
21
- In order to use the DeepAR Web SDK you need to set up a license key for your web app on [developer.deepar.ai](https://developer.deepar.ai).
22
- 1. Create an account: https://developer.deepar.ai/signup.
23
- 2. Create a project: https://developer.deepar.ai/projects.
24
- 3. Add a web app to the project. Note that you need to specify the domain name which you plan to use for hosting the app.
25
-
26
- > ⚠️ The license key property is required both in a production and development (localhost) environment. Development sessions will not count towards your monthly active usage.
27
-
28
- ## Getting started
29
- There are two main ways to get deepar.js in your JavaScript project:
30
- via [script tags](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_JavaScript_within_a_webpage)
31
- or by installing it from [NPM](https://www.npmjs.com/package/deepar)
32
- and using a build tool like
33
- [Parcel](https://parceljs.org/),
34
- [WebPack](https://webpack.js.org/),
35
- or [Rollup](https://rollupjs.org/guide/en).
36
-
37
- ### via Script tag
38
- Add the following code to an HTML file:
39
- ```html
40
- <html>
41
- <head>
42
- <!-- Load deepar.js -->
43
- <script src='https://cdn.jsdelivr.net/npm/deepar/js/deepar.js'> </script>
44
- </head>
45
-
46
- <body>
47
- <!-- Div element where AR preview will be inserted -->
48
- <div style='width: 640px; height: 360px' id='deepar-div'></div>
49
- <!-- Initialize DeepAR and load AR effect/filter -->
50
- <script>
51
- (async function() {
52
- const deepAR = await deepar.initialize({
53
- licenseKey: 'your_license_key_here',
54
- previewElement: document.querySelector('#deepar-div'),
55
- effect: 'https://cdn.jsdelivr.net/npm/deepar/effects/aviators'
56
- });
57
- })();
58
- </script>
59
- </body>
60
- </html>
61
- ```
62
-
63
- Alternatively, you can import DeepAR as an ES6 module.
64
-
65
- Via `<script type='module'>`.
66
- ```html
67
- <script type='module'>
68
- import * as deepar from 'https://cdn.jsdelivr.net/npm/deepar/js/deepar.esm.js';
69
- </script>
70
- ```
71
-
72
- Or via dynamic [import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import).
73
- ```javascript
74
- const deepar = await import('https://cdn.jsdelivr.net/npm/deepar/js/deepar.esm.js');
75
- ```
76
-
77
- ### via NPM
78
- Add deepar.js to your project using [yarn](https://yarnpkg.com/en/) or
79
- [npm](https://docs.npmjs.com/cli/npm).
80
-
81
- **Note**: Because we use ES2017 syntax (such as import),
82
- this workflow assumes you are using a modern browser or a
83
- bundler/transpiler to convert your code to something older browsers
84
- understand. However, you are free to use any build tool that you prefer.
85
-
86
- ```javascript
87
- import * as deepar from 'deepar';
88
-
89
- const deepAR = await deepar.initialize({
90
- licenseKey: 'your_license_key_here',
91
- previewElement: document.querySelector('#deepar-canvas'),
92
- effect: 'https://cdn.jsdelivr.net/npm/deepar/effects/aviators'
93
- });
94
- ```
95
-
96
- ## Switch effects
97
-
98
- AR filters are represented by effect files in DeepAR. You can load them to preview the effect.
99
-
100
- Places you can get DeepAR effects:
101
- - Download a free filter pack: https://docs.deepar.ai/deep-ar-studio/free-filter-pack.
102
- - Visit DeepAR asset store: https://www.store.deepar.ai/
103
- - Create your own filters with [DeepAR Studio](https://www.deepar.ai/creator-studio).
104
-
105
- Load an effect using the {@link DeepAR.switchEffect} method:
106
- ```javascript
107
- await deepAR.switchEffect('path/to/effect/alien');
108
- ```
109
-
110
- ## Take screenshot or video
111
-
112
- Take a screenshot.
113
- ```javascript
114
- // The image is a data url.
115
- const image = await deepAR.takeScreenshot();
116
- ```
117
-
118
- Record a video.
119
- ```javascript
120
- await deepAR.startVideoRecording();
121
- // Video is now recording...
122
- // When user is ready to stop recording.
123
- const video = await deepAR.finishVideoRecording();
124
- ```
125
-
126
- ## Background blur
127
-
128
- Enable background blur with strength 5.
129
- ```javascript
130
- await deepAR.backgroundBlur(true, 5)
131
- ```
132
-
133
- ## Background replacement
134
-
135
- This is also known as background removal or green screen effect.
136
-
137
- Enable background replacement with an image of a sunny beach.
138
- ```javascript
139
- await deepAR.backgroundReplacement(true, 'images/sunny_beach.png')
140
- ```
141
-
142
- ## Callbacks
143
-
144
- DeepAR has some callbacks you can implement for additional informations. For example,
145
- to check if feet are visible in the camera preview.
146
- ```javascript
147
- await deepAR.switchEffect('path/to/shoe-try-on-filter');
148
- deepAR.callbacks.onFeetTracked = (leftFoot, rightFoot) => {
149
- if(leftFoot.detected && rightFoot.detected) {
150
- console.log('Both foot detected!');
151
- } else if (leftFoot.detected) {
152
- console.log('Left foot detected!');
153
- } else if (rightFoot.detected) {
154
- console.log('Right foot detected!');
155
- } else {
156
- console.log('No feet detected!');
157
- }
158
- };
159
- ```
160
-
161
- See all available callbacks here {@link DeepARCallbacks}.
162
-
163
- To remove callback if you don't need it anymore.
164
- ```javascript
165
- delete deepAR.callbacks.onFeetTracked;
166
- ```
167
-
168
- ## Different video sources
169
-
170
- DeepAR will by default use the user facing camera. It will also ask the
171
- camera permission from the user.
172
-
173
- Use the back camera on the phones:
174
- ```javascript
175
- const deepAR = await deepar.initialize({
176
- // ...
177
- additionalOptions: {
178
- cameraConfig: {
179
- facingMode: 'environment'
180
- }
181
- }
182
- });
183
- ```
184
-
185
- Set up your own camera or custom video source:
186
- ```javascript
187
- const deepAR = await deepar.initialize({
188
- // ...
189
- additionalOptions: {
190
- cameraConfig: {
191
- disableDefaultCamera: true
192
- }
193
- }
194
- });
195
-
196
- // HTMLVideoElement that can contain camera or any video.
197
- const video = ...;
198
-
199
- deepAR.setVideoElement(video, true);
200
- ```
201
-
202
- Initialize DeepAR but start the camera later.
203
- This is used when you do not want to ask the camera permission right away.
204
- ```javascript
205
- const deepAR = await deepar.initialize({
206
- // ...
207
- additionalOptions: {
208
- cameraConfig: {
209
- disableDefaultCamera: true
210
- }
211
- }
212
- });
213
-
214
- // When you want to ask the camera permission and start the camera.
215
- await deepAR.startCamera();
216
- ```
217
-
218
- ## Providing your own canvas for rendering
219
-
220
- Create canvas directly in the HTML:
221
- ```html
222
- <canvas width='1280' height='720'></canvas>
223
- ```
224
-
225
- Or you can create it in Javascript.
226
- ```javascript
227
- const canvas = document.createElement('canvas');
228
- // Set canvas size, accounting screen resolution (to make it look 🤌 even on high definition displays)
229
- const canvasSize = { width: 640, height: 360 };
230
- const dpr = window.devicePixelRatio || 1;
231
- canvas.style.maxWidth = `${canvasSize.width}px`;
232
- canvas.style.maxHeight = `${canvasSize.height}px`;
233
- canvas.width = Math.floor(canvasSize.width * dpr);
234
- canvas.height = Math.floor(canvasSize.height * dpr);
235
- ```
236
-
237
- > ⚠️ **Note:** Be sure to set `width` and `height` properties of the `canvas`!
238
-
239
- You can always change the canvas dimensions and they don't have to match the
240
- input video resolution. DeepAR will fit the input camera/video stream correctly
241
- to any canvas size.
242
-
243
- You pass the canvas when initializing DeepAR.
244
- ```javascript
245
- await deepar.initialize({
246
- canvas: canvas,
247
- // ...
248
- });
249
- ```
250
-
251
- ## Download speed optimizations for DeepAR Web
252
-
253
- Apart from the main *deepar.js* file and AR effect files, DeepAR uses additional files like:
254
- - WebAssembly (WASM) files.
255
- - ML model files.
256
-
257
- Some of them are required and will be downloaded every time. The others will be lazy
258
- downloaded when/if needed.
259
-
260
- > ⚠️ DeepAR will by default automatically fetch all additional resources from the [JsDelivr](https://www.jsdelivr.com/) CDN.
261
-
262
- Fetching files from JsDelivr is not recommended if you care about download
263
- speeds of DeepAR Web resources. This is because the files on JsDelivr are not compressed.
264
-
265
- ### Compression
266
-
267
- To optimize download speeds, all the DeepAR files should be compressed.
268
- It is recommended to serve DeepAR files from your own server or some CDN which supports file compression.
269
-
270
- > If it is supported, you should use [GZip](https://developer.mozilla.org/en-US/docs/Glossary/GZip_compression) or
271
- > [Brotli](https://developer.mozilla.org/en-US/docs/Glossary/Brotli_compression) compression on all DeepAR files which will significantly reduce the
272
- > SDK size. Check out your server/CDN options for compressing files.
273
-
274
- ### Custom deployment of DeepAR Web
275
-
276
- DeepAR Web can be downloaded from [DeepAR Developer Portal](https://developer.deepar.ai/downloads).
277
- But since most users will install DeepAR through NPM, follow the next instructions.
278
-
279
- It is recommended to copy `./node_modules/deepar` directory which contains all the DeepAR
280
- files into your distribution (dist) folder.
281
- You can use `rootPath` to set a path to the custom root of the DeepAR SDK. All additional files
282
- that need to be fetched by DeepAR will be resolved against the given `rootPath`.
283
-
284
- ```javascript
285
- const deepAR = await deepar.initialize({
286
- // ...
287
- rootPath: 'path/to/root/deepar/directory'
288
- });
289
- ```
290
-
291
- > It is recommended to setup the copying of the DeepAR directory as part of you bundler build scripts,
292
- > in case you ever need to updated to a newer version of DeepAR.
293
-
294
- #### Specifying paths for each file
295
-
296
- Another option, instead of using the DeepAR directory and copying it as-is, is to specify
297
- a path to each file. The advantage of this is that you can use the bundler to keep track of your files.
298
-
299
- For example, if using [Webpack](https://webpack.js.org/), you can use it's
300
- [asset modules](https://webpack.js.org/guides/asset-modules/) to import all the files needed.
301
-
302
- Pass the file paths in `additionalOptions`.
303
-
304
- ```javascript
305
- const deepAR = await deepar.initialize({
306
- // ...
307
- additinalOptions: {
308
- faceTrackingConfig: {
309
- modelPath: 'path/to/deepar/models/face/models-68-extreme.bin'
310
- },
311
- segmentationConfig: {
312
- modelPath: 'path/to/deepar/models/segmentation/segmentation-160x160-opt.bin'
313
- },
314
- footTrackingConfig: {
315
- poseEstimationWasmPath: 'path/to/deepar/wasm/libxzimgPoseEstimation.wasm',
316
- detectorPath: 'path/to/deepar/models/foot/foot-detection-96x96x6.bin',
317
- trackerPath: 'path/to/deepar/models/foot/foot-tracker-96x96x18-test.bin',
318
- objPath: 'path/to/deepar/models/foot/foot-model.obj',
319
- tfjsBackendWasmPath: 'path/to/deepar/wasm/tfjs-backend-wasm.wasm',
320
- tfjsBackendWasmSimdPath: 'path/to/deepar/wasm/tfjs-backend-wasm-simd.wasm',
321
- tfjsBackendWasmThreadedSimdPath: 'path/to/deepar/wasm/tfjs-backend-wasm-threaded-simd.wasm',
322
- },
323
- deeparWasmPath: 'path/to/deepar/wasm/deepar.wasm'
324
- }
325
- });
326
- ```
package/lib/VERSION.txt DELETED
@@ -1 +0,0 @@
1
- DeepAR SDK version: v5.4.2-chromeExtension
Binary file