@pexip/media-processor 20.3.5 → 21.0.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 (118) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/api-docs/README.mdx +33 -6
  3. package/api-docs/functions/createBenchmark.mdx +17 -5
  4. package/api-docs/functions/createWindowedStats.mdx +23 -0
  5. package/api-docs/functions/iou.mdx +19 -0
  6. package/api-docs/functions/labelComponents.mdx +20 -0
  7. package/api-docs/functions/nearestPowerOfTwo.mdx +21 -0
  8. package/api-docs/functions/playVideo.mdx +16 -0
  9. package/api-docs/functions/scoreComponent.mdx +22 -0
  10. package/api-docs/functions/setVideoElementSrc.mdx +14 -0
  11. package/api-docs/interfaces/Benchmark.mdx +12 -0
  12. package/api-docs/interfaces/RendererOptions.mdx +26 -9
  13. package/api-docs/interfaces/SegmentationParams.mdx +29 -12
  14. package/api-docs/interfaces/SelectionOptions.mdx +15 -0
  15. package/api-docs/interfaces/Stats.mdx +11 -0
  16. package/api-docs/interfaces/Weights.mdx +12 -0
  17. package/api-docs/type-aliases/OptionalKeys.mdx +10 -0
  18. package/api-docs/variables/BACKGROUND_THRESHOLD.mdx +3 -0
  19. package/api-docs/variables/DOWN_SAMPLE_FACTOR.mdx +3 -0
  20. package/api-docs/variables/EDGE_BLUR_AMOUNT.mdx +1 -1
  21. package/api-docs/variables/EXCLUDE_BYSTANDERS.mdx +3 -0
  22. package/api-docs/variables/FOREGROUND_THRESHOLD.mdx +1 -1
  23. package/api-docs/variables/LIGHT_WRAP_BLUR_AMOUNT.mdx +3 -0
  24. package/api-docs/variables/LIGHT_WRAP_EDGE_BAND.mdx +3 -0
  25. package/api-docs/variables/LIGHT_WRAP_INTENSITY.mdx +3 -0
  26. package/api-docs/variables/LIGHT_WRAP_TIGHTNESS.mdx +3 -0
  27. package/api-docs/variables/MASK_COMBINE_RATIO.mdx +1 -1
  28. package/api-docs/variables/MORPH_DILATE_RADIUS_PX.mdx +3 -0
  29. package/api-docs/variables/MORPH_ERODE_RADIUS_PX.mdx +3 -0
  30. package/api-docs/variables/MORPH_PASS.mdx +3 -0
  31. package/api-docs/variables/PERSON_CENTER.mdx +3 -0
  32. package/api-docs/variables/SIGMA_RANGE.mdx +3 -0
  33. package/api-docs/variables/SIGMA_SPACE.mdx +3 -0
  34. package/api-docs/variables/STRONG_EDGE_BLUR_AMOUNT.mdx +3 -0
  35. package/api-docs/variables/getCanvasRenderingContext2D.mdx +14 -0
  36. package/api-docs/variables/getImageSize.mdx +13 -0
  37. package/dist/common/backends/webgl/binaryMask.d.ts +8 -0
  38. package/dist/common/backends/webgl/binaryMask.js +95 -0
  39. package/dist/common/backends/webgl/blender.d.ts +2 -1
  40. package/dist/common/backends/webgl/blender.js +18 -15
  41. package/dist/common/backends/webgl/blur.d.ts +1 -1
  42. package/dist/common/backends/webgl/blur.js +23 -16
  43. package/dist/common/backends/webgl/canvas.js +9 -4
  44. package/dist/common/backends/webgl/diffAbsMask.d.ts +10 -0
  45. package/dist/common/backends/webgl/diffAbsMask.js +103 -0
  46. package/dist/common/backends/webgl/geodesicReconstruction.d.ts +13 -0
  47. package/dist/common/backends/webgl/geodesicReconstruction.js +176 -0
  48. package/dist/common/backends/webgl/jointBilateralFilter.d.ts +12 -0
  49. package/dist/common/backends/webgl/jointBilateralFilter.js +108 -0
  50. package/dist/common/backends/webgl/morphErode.d.ts +13 -0
  51. package/dist/common/backends/webgl/morphErode.js +121 -0
  52. package/dist/common/backends/webgl/renderer.js +194 -34
  53. package/dist/common/backends/webgl/replace.d.ts +17 -0
  54. package/dist/common/backends/webgl/replace.js +126 -0
  55. package/dist/common/backends/webgl/selectComponent.d.ts +15 -0
  56. package/dist/common/backends/webgl/selectComponent.js +102 -0
  57. package/dist/common/backends/webgl/smoothingMask.d.ts +3 -3
  58. package/dist/common/backends/webgl/smoothingMask.js +22 -21
  59. package/dist/common/backends/webgl/tentBlur.d.ts +9 -0
  60. package/dist/common/backends/webgl/tentBlur.js +118 -0
  61. package/dist/common/backends/webgl/texture.d.ts +1 -1
  62. package/dist/common/backends/webgl/texture.js +19 -17
  63. package/dist/common/backends/webgl/textureToTexture.d.ts +1 -1
  64. package/dist/common/backends/webgl/textureToTexture.js +19 -16
  65. package/dist/common/backends/webgl/webglUtils.d.ts +7 -1
  66. package/dist/common/backends/webgl/webglUtils.js +64 -6
  67. package/dist/common/backends/webgpu/blender.d.ts +6 -1
  68. package/dist/common/backends/webgpu/blender.js +96 -51
  69. package/dist/common/backends/webgpu/constants.js +1 -1
  70. package/dist/common/backends/webgpu/dualFilterBlur.d.ts +2 -3
  71. package/dist/common/backends/webgpu/dualFilterBlur.js +146 -140
  72. package/dist/common/backends/webgpu/jointBilateralFilter.d.ts +7 -0
  73. package/dist/common/backends/webgpu/jointBilateralFilter.js +162 -0
  74. package/dist/common/backends/webgpu/renderer.js +211 -39
  75. package/dist/common/backends/webgpu/replace.d.ts +11 -0
  76. package/dist/common/backends/webgpu/replace.js +175 -0
  77. package/dist/common/backends/webgpu/resize.d.ts +4 -0
  78. package/dist/common/backends/webgpu/resize.js +76 -0
  79. package/dist/common/backends/webgpu/smoothingMask.d.ts +2 -2
  80. package/dist/common/backends/webgpu/smoothingMask.js +74 -40
  81. package/dist/common/backends/webgpu/tentBlur.d.ts +5 -0
  82. package/dist/common/backends/webgpu/tentBlur.js +131 -0
  83. package/dist/common/backends/webgpu/texture.d.ts +2 -2
  84. package/dist/common/backends/webgpu/texture.js +24 -19
  85. package/dist/common/backends/webgpu/textureToTexture.d.ts +1 -1
  86. package/dist/common/backends/webgpu/textureToTexture.js +28 -15
  87. package/dist/common/backends/webgpu/types.d.ts +2 -0
  88. package/dist/common/backends/webgpu/webgpuUtils.d.ts +24 -4
  89. package/dist/common/backends/webgpu/webgpuUtils.js +60 -11
  90. package/dist/common/constants.d.ts +19 -5
  91. package/dist/common/constants.js +19 -5
  92. package/dist/common/index.d.ts +1 -0
  93. package/dist/common/index.js +1 -0
  94. package/dist/common/tsconfig.tsbuildinfo +1 -1
  95. package/dist/common/types/render.d.ts +142 -13
  96. package/dist/common/types/utils.d.ts +21 -0
  97. package/dist/common/utils.d.ts +16 -0
  98. package/dist/common/utils.js +152 -0
  99. package/dist/main/benchUtils.d.ts +33 -1
  100. package/dist/main/benchUtils.js +145 -11
  101. package/dist/main/tsconfig.tsbuildinfo +1 -1
  102. package/dist/main/video/canvasTransform.d.ts +1 -1
  103. package/dist/main/video/canvasTransform.js +135 -47
  104. package/dist/main/video/index.d.ts +1 -1
  105. package/dist/main/video/index.js +1 -1
  106. package/dist/workers/mediaWorker.js +35 -162
  107. package/dist/workers/tsconfig.tsbuildinfo +1 -1
  108. package/package.json +8 -7
  109. package/dist/common/backends/webgl/shaders/blendFragmentShader.d.ts +0 -1
  110. package/dist/common/backends/webgl/shaders/blendFragmentShader.js +0 -21
  111. package/dist/common/backends/webgl/shaders/dualFilterBlurFragmentShader.d.ts +0 -1
  112. package/dist/common/backends/webgl/shaders/dualFilterBlurFragmentShader.js +0 -45
  113. package/dist/common/backends/webgl/shaders/smoothingMaskFragmentShader.d.ts +0 -1
  114. package/dist/common/backends/webgl/shaders/smoothingMaskFragmentShader.js +0 -57
  115. package/dist/common/backends/webgl/shaders/textureFragmentShader.d.ts +0 -1
  116. package/dist/common/backends/webgl/shaders/textureFragmentShader.js +0 -16
  117. package/dist/common/backends/webgl/shaders/vertexShader.d.ts +0 -1
  118. package/dist/common/backends/webgl/shaders/vertexShader.js +0 -19
package/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # Changelog
2
2
 
3
+ ## 21.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 3963c2e: Post-processing the segmentation mask
8
+
9
+ - Add downsampling post-processing
10
+ - Refine mask boundaries for more edge snappy
11
+ - Reduce the gaps between the segmented areas
12
+ - Add bystander removal
13
+
14
+ ### Minor Changes
15
+
16
+ - 4cc4701: WebGPU implementation improvements:
17
+
18
+ - Port WebGL2 post-processing steps to WebGPU, matching mask/edge quality and
19
+ performance
20
+ - Implement compute-based separable joint bilateral filter for mask refinement
21
+ - Add compute tent blur for edge feathering, using single half-float channel
22
+ for mask
23
+ - Introduce downsample/upsample and dual filter blur in compute for optimized
24
+ background effects
25
+ - Cache pipelines and textures to reduce per-frame allocation overhead
26
+ - Use `r16float` mask storage when available for efficiency
27
+ - Improve blend quality with smoothstep edge softening
28
+ - Integrate light wrap and H.264 noise stabilization into compositing
29
+
30
+ ### Patch Changes
31
+
32
+ - 24bc717: Fix added noise YUV->RBG negative value issue
33
+ - 872971f: Mark `excludeBystanders` related params as `@experimental`:
34
+ `personCenter`, `morphErodeRadiusPx`, `morphPass`, and `morphDilateRadiusPx`
35
+ - 2e895ac: Add add an `@experimental` tag for `excludeBystanders`
36
+ - 4eaf9d7: Use the correct region to apply noise
37
+ - Updated dependencies [1fff975]
38
+ - Updated dependencies [3963c2e]
39
+ - Updated dependencies [762ebd2]
40
+ - @pexip/utils@17.2.0
41
+
3
42
  ## 20.3.5
4
43
 
5
44
  ### Patch Changes
@@ -211,7 +211,7 @@ A library for media analysis using Web APIs.
211
211
  | [ProcessorProcessOptions](interfaces/ProcessorProcessOptions.mdx) | - |
212
212
  | [ProcessWorkerDebugMessage](interfaces/ProcessWorkerDebugMessage.mdx) | - |
213
213
  | [ProcessorEvent](interfaces/ProcessorEvent.mdx) | - |
214
- | [RendererOptions](interfaces/RendererOptions.mdx) | - |
214
+ | [RendererOptions](interfaces/RendererOptions.mdx) | Options controlling the rendering and effects for person/background segmentation. All values are stable per-frame and can be safely updated in real-time. |
215
215
  | [Renderer](interfaces/Renderer.mdx) | - |
216
216
  | [RenderEventHandlers](interfaces/RenderEventHandlers.mdx) | - |
217
217
  | [SegmentationModelAsset](interfaces/SegmentationModelAsset.mdx) | Segmentation model asset that can be used to load a segmentation model. |
@@ -219,6 +219,9 @@ A library for media analysis using Web APIs.
219
219
  | [SegmenterOptions](interfaces/SegmenterOptions.mdx) | - |
220
220
  | [SegmentationSmoothingConfig](interfaces/SegmentationSmoothingConfig.mdx) | - |
221
221
  | [MPMask](interfaces/MPMask.mdx) | Wrapper for a mask produced by a Segmentation Task. |
222
+ | [Stats](interfaces/Stats.mdx) | - |
223
+ | [Weights](interfaces/Weights.mdx) | - |
224
+ | [SelectionOptions](interfaces/SelectionOptions.mdx) | - |
222
225
  | [Benchmark](interfaces/Benchmark.mdx) | - |
223
226
  | [Point](interfaces/Point.mdx) | Interface for Point consist of coordinates x and y |
224
227
  | [Size](interfaces/Size.mdx) | - |
@@ -245,7 +248,7 @@ A library for media analysis using Web APIs.
245
248
  | [BackgroundImage](interfaces/BackgroundImage.mdx) | - |
246
249
  | [Segmenter](interfaces/Segmenter.mdx) | - |
247
250
  | [Detector](interfaces/Detector.mdx) | - |
248
- | [SegmentationParams](interfaces/SegmentationParams.mdx) | - |
251
+ | [SegmentationParams](interfaces/SegmentationParams.mdx) | Options controlling the rendering and effects for person/background segmentation. All values are stable per-frame and can be safely updated in real-time. |
249
252
  | [VideoProcessor](interfaces/VideoProcessor.mdx) | - |
250
253
 
251
254
  ## Type Aliases
@@ -268,6 +271,7 @@ A library for media analysis using Web APIs.
268
271
  | [ExtractMessageEventType](type-aliases/ExtractMessageEventType.mdx) | - |
269
272
  | [IncludeMessageEventDataType](type-aliases/IncludeMessageEventDataType.mdx) | - |
270
273
  | [TupleOf](type-aliases/TupleOf.mdx) | From https://github.com/Microsoft/TypeScript/issues/26223#issuecomment-674500430 |
274
+ | [OptionalKeys](type-aliases/OptionalKeys.mdx) | - |
271
275
  | [Canvas](type-aliases/Canvas.mdx) | - |
272
276
  | [Unsubscribe](type-aliases/Unsubscribe.mdx) | Unsubscribe the subscription |
273
277
  | [AudioBufferFloats](type-aliases/AudioBufferFloats.mdx) | Same as [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) Or the return from [AnalyserNode.getFloatFrequencyData()](https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getFloatFrequencyData) |
@@ -312,12 +316,28 @@ A library for media analysis using Web APIs.
312
316
 
313
317
  | Variable | Description |
314
318
  | ------ | ------ |
315
- | [PROCESSING\_WIDTH](variables/PROCESSING_WIDTH.mdx) | - |
316
- | [PROCESSING\_HEIGHT](variables/PROCESSING_HEIGHT.mdx) | - |
317
- | [FOREGROUND\_THRESHOLD](variables/FOREGROUND_THRESHOLD.mdx) | - |
319
+ | [getCanvasRenderingContext2D](variables/getCanvasRenderingContext2D.mdx) | - |
320
+ | [getImageSize](variables/getImageSize.mdx) | - |
318
321
  | [BACKGROUND\_BLUR\_AMOUNT](variables/BACKGROUND_BLUR_AMOUNT.mdx) | - |
322
+ | [BACKGROUND\_THRESHOLD](variables/BACKGROUND_THRESHOLD.mdx) | - |
323
+ | [DOWN\_SAMPLE\_FACTOR](variables/DOWN_SAMPLE_FACTOR.mdx) | - |
319
324
  | [EDGE\_BLUR\_AMOUNT](variables/EDGE_BLUR_AMOUNT.mdx) | - |
325
+ | [EXCLUDE\_BYSTANDERS](variables/EXCLUDE_BYSTANDERS.mdx) | - |
326
+ | [FOREGROUND\_THRESHOLD](variables/FOREGROUND_THRESHOLD.mdx) | - |
327
+ | [LIGHT\_WRAP\_BLUR\_AMOUNT](variables/LIGHT_WRAP_BLUR_AMOUNT.mdx) | - |
328
+ | [LIGHT\_WRAP\_EDGE\_BAND](variables/LIGHT_WRAP_EDGE_BAND.mdx) | - |
329
+ | [LIGHT\_WRAP\_INTENSITY](variables/LIGHT_WRAP_INTENSITY.mdx) | - |
330
+ | [LIGHT\_WRAP\_TIGHTNESS](variables/LIGHT_WRAP_TIGHTNESS.mdx) | - |
320
331
  | [MASK\_COMBINE\_RATIO](variables/MASK_COMBINE_RATIO.mdx) | - |
332
+ | [MORPH\_DILATE\_RADIUS\_PX](variables/MORPH_DILATE_RADIUS_PX.mdx) | - |
333
+ | [MORPH\_ERODE\_RADIUS\_PX](variables/MORPH_ERODE_RADIUS_PX.mdx) | - |
334
+ | [MORPH\_PASS](variables/MORPH_PASS.mdx) | - |
335
+ | [PERSON\_CENTER](variables/PERSON_CENTER.mdx) | - |
336
+ | [PROCESSING\_HEIGHT](variables/PROCESSING_HEIGHT.mdx) | - |
337
+ | [PROCESSING\_WIDTH](variables/PROCESSING_WIDTH.mdx) | - |
338
+ | [SIGMA\_RANGE](variables/SIGMA_RANGE.mdx) | - |
339
+ | [SIGMA\_SPACE](variables/SIGMA_SPACE.mdx) | - |
340
+ | [STRONG\_EDGE\_BLUR\_AMOUNT](variables/STRONG_EDGE_BLUR_AMOUNT.mdx) | - |
321
341
  | [PROCESS\_STATUS](variables/PROCESS_STATUS.mdx) | Process status |
322
342
  | [RENDER\_EFFECT](variables/RENDER_EFFECT.mdx) | - |
323
343
  | [RENDER\_BACKEND](variables/RENDER_BACKEND.mdx) | - |
@@ -348,6 +368,10 @@ A library for media analysis using Web APIs.
348
368
 
349
369
  | Function | Description |
350
370
  | ------ | ------ |
371
+ | [nearestPowerOfTwo](functions/nearestPowerOfTwo.mdx) | Coerce any positive number to the nearest power of two within [minPow, maxPow] Example: nearestPowerOfTwo(13) => 16; nearestPowerOfTwo(3.2) => 4 |
372
+ | [iou](functions/iou.mdx) | Intersection over Union (IoU), how much two masks overlap as a fraction of either's total. 1.0 = perfect match, 0 = no overlap. Used for stable, robust tracking of the main person between frames, especially with bystander removal and temporal instance switching. |
373
+ | [labelComponents](functions/labelComponents.mdx) | - |
374
+ | [scoreComponent](functions/scoreComponent.mdx) | - |
351
375
  | [createAudioContext](functions/createAudioContext.mdx) | A function to create `AudioContext` using constructor or factory function depends on the browser supports |
352
376
  | [resumeAudioOnInterruption](functions/resumeAudioOnInterruption.mdx) | Resume the stream whenever interrupted |
353
377
  | [resumeAudioOnUnmute](functions/resumeAudioOnUnmute.mdx) | Resume the AudioContext whenever the source track is unmuted |
@@ -366,7 +390,8 @@ A library for media analysis using Web APIs.
366
390
  | [createChannelMergerGraphNode](functions/createChannelMergerGraphNode.mdx) | Create a ChannelMergerNode |
367
391
  | [createAudioGraph](functions/createAudioGraph.mdx) | Accepts AudioNodeInitConnections to build the audio graph within a signal audio context |
368
392
  | [createAudioGraphProxy](functions/createAudioGraphProxy.mdx) | - |
369
- | [createBenchmark](functions/createBenchmark.mdx) | - |
393
+ | [createBenchmark](functions/createBenchmark.mdx) | Creates a benchmarking utility for measuring frame durations and calculating frames per second (FPS). |
394
+ | [createWindowedStats](functions/createWindowedStats.mdx) | - |
370
395
  | [sum](functions/sum.mdx) | Sum an array of numbers |
371
396
  | [avg](functions/avg.mdx) | Average an array of numbers |
372
397
  | [pow](functions/pow.mdx) | pow function from Math in functional form `number -> number -> number` |
@@ -400,6 +425,8 @@ A library for media analysis using Web APIs.
400
425
  | [createSegmenter](functions/createSegmenter.mdx) | - |
401
426
  | [isRenderEffects](functions/isRenderEffects.mdx) | - |
402
427
  | [createCanvas](functions/createCanvas.mdx) | Create a Canvas element with provided width and height |
428
+ | [setVideoElementSrc](functions/setVideoElementSrc.mdx) | - |
429
+ | [playVideo](functions/playVideo.mdx) | - |
403
430
  | [createFrameCallbackRequest](functions/createFrameCallbackRequest.mdx) | Create a callback loop for video frame processing using `requestVideoFrameCallback` under-the-hood when available otherwise our fallback implementation based on `setTimeout`. |
404
431
  | [createVideoProcessor](functions/createVideoProcessor.mdx) | - |
405
432
  | [createVideoTrackProcessor](functions/createVideoTrackProcessor.mdx) | Video track processor using MediaStreamTrackProcessor API |
@@ -1,14 +1,26 @@
1
1
  ```ts
2
- function createBenchmark(clock, __namedParameters): Benchmark;
2
+ function createBenchmark(clock, options): Benchmark;
3
3
  ```
4
4
 
5
+ Creates a benchmarking utility for measuring frame durations and calculating frames per second (FPS).
6
+
5
7
  ## Parameters
6
8
 
7
- | Parameter | Type | Default value |
8
- | ------ | ------ | ------ |
9
- | `clock` | [`Clock`](../interfaces/Clock.mdx) | `performance` |
10
- | `__namedParameters` | `BenchmarkOptions` | `{}` |
9
+ | Parameter | Type | Default value | Description |
10
+ | ------ | ------ | ------ | ------ |
11
+ | `clock` | [`Clock`](../interfaces/Clock.mdx) | `performance` | An object with a `now()` method returning the current timestamp (in milliseconds). Defaults to `window.performance`. |
12
+ | `options` | `BenchmarkOptions` | `{}` | Optional configuration options for the benchmark utility. |
11
13
 
12
14
  ## Returns
13
15
 
14
16
  [`Benchmark`](../interfaces/Benchmark.mdx)
17
+
18
+ An object with methods to start/end frame measurements, reset the benchmark, and calculate current FPS.
19
+
20
+ ## Remarks
21
+
22
+ This function is designed for performance measurement in animation or game loops.
23
+ It records frame start/end times, ignores an initial warmup period, utilizes a circular buffer
24
+ to average recent frame durations, and computes a smoothed FPS value on demand.
25
+ The calculation may only occur if sufficient samples have been gathered and the minimum interval between
26
+ calculations has elapsed.
@@ -0,0 +1,23 @@
1
+ ```ts
2
+ function createWindowedStats(windowSize): object;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `windowSize` | `number` |
10
+
11
+ ## Returns
12
+
13
+ `object`
14
+
15
+ | Name | Type |
16
+ | ------ | ------ |
17
+ | `add()` | (`value`) => `void` |
18
+ | `get mean` | `number` |
19
+ | `get variance` | `number` |
20
+ | `get stddev` | `number` |
21
+ | `get stdError` | `number` |
22
+ | `get count` | `number` |
23
+ | `clear()` | () => `void` |
@@ -0,0 +1,19 @@
1
+ ```ts
2
+ function iou(a, b): number;
3
+ ```
4
+
5
+ Intersection over Union (IoU), how much two masks overlap as a fraction of either's total.
6
+ 1.0 = perfect match, 0 = no overlap.
7
+ Used for stable, robust tracking of the main person between frames,
8
+ especially with bystander removal and temporal instance switching.
9
+
10
+ ## Parameters
11
+
12
+ | Parameter | Type |
13
+ | ------ | ------ |
14
+ | `a` | `Uint8Array` |
15
+ | `b` | `Uint8Array` |
16
+
17
+ ## Returns
18
+
19
+ `number`
@@ -0,0 +1,20 @@
1
+ ```ts
2
+ function labelComponents(
3
+ input,
4
+ labels,
5
+ width,
6
+ height): Map<number, Stats>;
7
+ ```
8
+
9
+ ## Parameters
10
+
11
+ | Parameter | Type |
12
+ | ------ | ------ |
13
+ | `input` | `Uint8Array` |
14
+ | `labels` | `Int32Array` |
15
+ | `width` | `number` |
16
+ | `height` | `number` |
17
+
18
+ ## Returns
19
+
20
+ `Map`\<`number`, [`Stats`](../interfaces/Stats.mdx)\>
@@ -0,0 +1,21 @@
1
+ ```ts
2
+ function nearestPowerOfTwo(
3
+ n,
4
+ minPow?,
5
+ maxPow?): number;
6
+ ```
7
+
8
+ Coerce any positive number to the nearest power of two within [minPow, maxPow]
9
+ Example: nearestPowerOfTwo(13) => 16; nearestPowerOfTwo(3.2) => 4
10
+
11
+ ## Parameters
12
+
13
+ | Parameter | Type |
14
+ | ------ | ------ |
15
+ | `n` | `number` |
16
+ | `minPow?` | `number` |
17
+ | `maxPow?` | `number` |
18
+
19
+ ## Returns
20
+
21
+ `number`
@@ -0,0 +1,16 @@
1
+ ```ts
2
+ function playVideo(video, __namedParameters): Promise<void>;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `video` | `HTMLVideoElement` |
10
+ | `__namedParameters` | \{ `setTimeout?`: (`handler`, `timeout?`, ...`arguments`) => `number` & (`handler`, `timeout?`, ...`arguments`) => `number`; `clearTimeout?`: (`id`) => `void` & (`id`) => `void`; \} |
11
+ | `__namedParameters.setTimeout?` | (`handler`, `timeout?`, ...`arguments`) => `number` & (`handler`, `timeout?`, ...`arguments`) => `number` |
12
+ | `__namedParameters.clearTimeout?` | (`id`) => `void` & (`id`) => `void` |
13
+
14
+ ## Returns
15
+
16
+ `Promise`\<`void`\>
@@ -0,0 +1,22 @@
1
+ ```ts
2
+ function scoreComponent(
3
+ stats,
4
+ overlap,
5
+ weights,
6
+ width,
7
+ height): number;
8
+ ```
9
+
10
+ ## Parameters
11
+
12
+ | Parameter | Type |
13
+ | ------ | ------ |
14
+ | `stats` | [`Stats`](../interfaces/Stats.mdx) |
15
+ | `overlap` | `number` |
16
+ | `weights` | [`SelectionOptions`](../interfaces/SelectionOptions.mdx) |
17
+ | `width` | `number` |
18
+ | `height` | `number` |
19
+
20
+ ## Returns
21
+
22
+ `number`
@@ -0,0 +1,14 @@
1
+ ```ts
2
+ function setVideoElementSrc(video, src): void;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `video` | `HTMLVideoElement` |
10
+ | `src` | `MediaProvider` |
11
+
12
+ ## Returns
13
+
14
+ `void`
@@ -24,6 +24,18 @@ end(): void;
24
24
 
25
25
  ***
26
26
 
27
+ ### reset()
28
+
29
+ ```ts
30
+ reset(): void;
31
+ ```
32
+
33
+ #### Returns
34
+
35
+ `void`
36
+
37
+ ***
38
+
27
39
  ### calculateFps()
28
40
 
29
41
  ```ts
@@ -1,15 +1,32 @@
1
+ Options controlling the rendering and effects for person/background segmentation.
2
+ All values are stable per-frame and can be safely updated in real-time.
3
+
1
4
  ## Extended by
2
5
 
3
6
  - [`SegmentationParams`](SegmentationParams.mdx)
4
7
 
5
8
  ## Properties
6
9
 
7
- | Property | Type | Default value | Description |
8
- | ------ | ------ | ------ | ------ |
9
- | <a id="backgroundimageurl"></a> `backgroundImageUrl` | `string` | `undefined` | - |
10
- | <a id="foregroundthreshold"></a> `foregroundThreshold` | `number` | `undefined` | Confident score threshold to be considered as the foreground between 0 and 1 |
11
- | <a id="backgroundbluramount"></a> `backgroundBlurAmount` | `number` | `undefined` | Between 0 and 10 |
12
- | <a id="edgebluramount"></a> `edgeBlurAmount` | `number` | `3` | Range in between 0 and 20 |
13
- | <a id="maskcombineratio"></a> `maskCombineRatio` | `number` | `undefined` | The ratio used for smoothing the mask between 0 and 1 |
14
- | <a id="effects"></a> `effects` | `"blur"` \| `"none"` \| `"overlay"` | `undefined` | Effects |
15
- | <a id="backend"></a> `backend` | `"webgl"` \| `"webgpu"` | `undefined` | Backend to render background effects |
10
+ | Property | Type | Description |
11
+ | ------ | ------ | ------ |
12
+ | <a id="backgroundimageurl"></a> `backgroundImageUrl` | `string` | URL or Data URI for the virtual background image (used in "overlay" effect). |
13
+ | <a id="backgroundbluramount"></a> `backgroundBlurAmount` | `number` | Amount of background blur (radius in px): [0,9]. Recommend: 3–6 for portraits. Higher may be slow and over-blurred. **Default** `3` |
14
+ | <a id="edgebluramount"></a> `edgeBlurAmount` | `number` | Edge blur for mask boundary antialiasing (radius in px): [0,9]. Small values (1–5) smooth mask stair-steps; large values soften edges more visibly. **Default** `4` |
15
+ | <a id="effects"></a> `effects` | `"blur"` \| `"none"` \| `"overlay"` | Effects to apply: "none", "blur", or "overlay". "blur" = background blur. "overlay" = replace BG with backgroundImageUrl. |
16
+ | <a id="backend"></a> `backend` | `"webgl"` \| `"webgpu"` | Backend to render background effects |
17
+ | <a id="foregroundthreshold"></a> `foregroundThreshold` | `number` | [0,1] Upper mask confidence: all mask pixels >= this are considered definite foreground. Adjust to make mask edges tighter or more permissive for foreground inclusion. Example: 0.8 ("mask > 0.8 = sure foreground"). Must always be >= backgroundThreshold. **Default** `0.85` |
18
+ | <a id="backgroundthreshold"></a> `backgroundThreshold` | `number` | [0,1] Lower mask confidence: all mask pixels <= this are considered definite background. Adjust to make mask edges tighter or more permissive for background inclusion. Example: 0.3 ("mask < 0.3 = sure background"). **Default** `0.35` |
19
+ | <a id="sigmaspace"></a> `sigmaSpace` | `number` | Bilateral filter: sigma in pixel space for mask edge snapping. Controls the neighborhood/pixel distance—higher is larger window (5–10 typical). **Default** `5` |
20
+ | <a id="sigmarangelo"></a> `sigmaRangeLo` | `number` | Bilateral filter: minimum sigma in color/luma (for mask interiors), [0,1]. Controls how little color difference is needed to cross-mask regions away from edge. Lower = sharper edge preservation in mask interiors. Example: 0.2 **Default** `0.2` |
21
+ | <a id="sigmarangehi"></a> `sigmaRangeHi` | `number` | Bilateral filter: maximum sigma in color/luma (for mask uncertain zones), [0,1]. Controls how much color similarity is required at uncertain/edge mask locations. Higher = more mask smoothing at edges. Example: 0.8 **Default** `0.8` |
22
+ | <a id="maskcombineratio"></a> `maskCombineRatio` | `number` | Ratio for mask smoothing (how much uncertainty enables temporal blend), [0,1]. Higher = more frame-to-frame blending, more stability but more trailing ghosts. Typical: 0.6–0.85. **Default** `0.8` |
23
+ | <a id="excludebystanders"></a> `excludeBystanders` | `boolean` | **`Experimental`** Whether to exclude bystanders/connected people from the output mask. The main person instance (closest to personCenter OR largest blob) is kept in the output mask. All other bystanders/connected people are suppressed (bystander removal). **Default** `false (no bystander removal, all detected people are included in the mask). @experimental This feature is experimental and only works in WebGL backend.` |
24
+ | <a id="personcenter"></a> `personCenter` | \[`number`, `number`\] | **`Experimental`** Person center: normalized (x, y) in [0,1] image coordinates for main subject selection. Used by the CCL/bias filter to select the main person blob. **Default** `[0.5, 0.42] (= center, slightly above vertical midpoint). @experimental This feature is experimental and only works in WebGL backend.` |
25
+ | <a id="morpheroderadiuspx"></a> `morphErodeRadiusPx` | `number` | **`Experimental`** Morphological erosion: radius in pixels [1,12]. Sets kernel size for bridge-breaking. Larger values break thicker bridges but may erode fine details. **Default** `5 @experimental This feature is experimental and only works in WebGL backend.` |
26
+ | <a id="morphpass"></a> `morphPass` | `number` | **`Experimental`** Morphological pass: number of separable passes [1,10]. More passes increase the effective span. **Default** `4 @experimental This feature is experimental and only works in WebGL backend.` |
27
+ | <a id="morphdilateradiuspx"></a> `morphDilateRadiusPx` | `number` | **`Experimental`** Geodesic dilation: radius in pixels [1,12]. Must match erosion for good reconstruction. **Default** `6 @experimental This feature is experimental and only works in WebGL backend.` |
28
+ | <a id="lightwrapintensity"></a> `lightWrapIntensity` | `number` | [0,1] Light wrap amount (halo intensity) at mask edge. Wraps blurred background color just outside the subject edge onto the subject boundary for realism. **Default** `0.8` |
29
+ | <a id="lightwraptightness"></a> `lightWrapTightness` | `number` | [0.5,4.0] Controls power/tightness of the wrap band falloff. Higher = tighter/narrower wrap. **Default** `1.2` |
30
+ | <a id="lightwrapedgeband"></a> `lightWrapEdgeBand` | `number` | Width of the wrap band (feather size, in normalized mask units) between the backgroundThreshold and foregroundThreshold in [0.0, (foregroundThreshold - backgroundThreshold) / 2] Higher = wider soft halo. **Default** `0.25` |
31
+ | <a id="lightwrapbluramount"></a> `lightWrapBlurAmount` | `number` | Blur amount used for background color in the wrap band (units=blur passes). **Default** `1` |
32
+ | <a id="downsamplefactor"></a> `downSampleFactor` | `number` | Downsampling factor for mask/blurring, must be [2,4]. 2 = half resolution, 4 = quarter resolution for faster filtering. Use for performance tuning vs. quality. **Default** `2` |
@@ -1,18 +1,35 @@
1
+ Options controlling the rendering and effects for person/background segmentation.
2
+ All values are stable per-frame and can be safely updated in real-time.
3
+
1
4
  ## Extends
2
5
 
3
6
  - [`RendererOptions`](RendererOptions.mdx)
4
7
 
5
8
  ## Properties
6
9
 
7
- | Property | Type | Default value | Description | Inherited from |
8
- | ------ | ------ | ------ | ------ | ------ |
9
- | <a id="backgroundimageurl"></a> `backgroundImageUrl` | `string` | `undefined` | - | [`RendererOptions`](RendererOptions.mdx).[`backgroundImageUrl`](RendererOptions.mdx#backgroundimageurl) |
10
- | <a id="foregroundthreshold"></a> `foregroundThreshold` | `number` | `undefined` | Confident score threshold to be considered as the foreground between 0 and 1 | [`RendererOptions`](RendererOptions.mdx).[`foregroundThreshold`](RendererOptions.mdx#foregroundthreshold) |
11
- | <a id="backgroundbluramount"></a> `backgroundBlurAmount` | `number` | `undefined` | Between 0 and 10 | [`RendererOptions`](RendererOptions.mdx).[`backgroundBlurAmount`](RendererOptions.mdx#backgroundbluramount) |
12
- | <a id="edgebluramount"></a> `edgeBlurAmount` | `number` | `3` | Range in between 0 and 20 | [`RendererOptions`](RendererOptions.mdx).[`edgeBlurAmount`](RendererOptions.mdx#edgebluramount) |
13
- | <a id="maskcombineratio"></a> `maskCombineRatio` | `number` | `undefined` | The ratio used for smoothing the mask between 0 and 1 | [`RendererOptions`](RendererOptions.mdx).[`maskCombineRatio`](RendererOptions.mdx#maskcombineratio) |
14
- | <a id="effects"></a> `effects` | `"blur"` \| `"none"` \| `"overlay"` | `undefined` | Effects | [`RendererOptions`](RendererOptions.mdx).[`effects`](RendererOptions.mdx#effects) |
15
- | <a id="backend"></a> `backend` | `"webgl"` \| `"webgpu"` | `undefined` | Backend to render background effects | [`RendererOptions`](RendererOptions.mdx).[`backend`](RendererOptions.mdx#backend) |
16
- | <a id="segmenter"></a> `segmenter` | [`Segmenter`](Segmenter.mdx) | `undefined` | - | - |
17
- | <a id="width"></a> `width` | `number` | `undefined` | - | - |
18
- | <a id="height"></a> `height` | `number` | `undefined` | - | - |
10
+ | Property | Type | Description | Inherited from |
11
+ | ------ | ------ | ------ | ------ |
12
+ | <a id="backgroundimageurl"></a> `backgroundImageUrl` | `string` | URL or Data URI for the virtual background image (used in "overlay" effect). | [`RendererOptions`](RendererOptions.mdx).[`backgroundImageUrl`](RendererOptions.mdx#backgroundimageurl) |
13
+ | <a id="backgroundbluramount"></a> `backgroundBlurAmount` | `number` | Amount of background blur (radius in px): [0,9]. Recommend: 3–6 for portraits. Higher may be slow and over-blurred. **Default** `3` | [`RendererOptions`](RendererOptions.mdx).[`backgroundBlurAmount`](RendererOptions.mdx#backgroundbluramount) |
14
+ | <a id="edgebluramount"></a> `edgeBlurAmount` | `number` | Edge blur for mask boundary antialiasing (radius in px): [0,9]. Small values (1–5) smooth mask stair-steps; large values soften edges more visibly. **Default** `4` | [`RendererOptions`](RendererOptions.mdx).[`edgeBlurAmount`](RendererOptions.mdx#edgebluramount) |
15
+ | <a id="effects"></a> `effects` | `"blur"` \| `"none"` \| `"overlay"` | Effects to apply: "none", "blur", or "overlay". "blur" = background blur. "overlay" = replace BG with backgroundImageUrl. | [`RendererOptions`](RendererOptions.mdx).[`effects`](RendererOptions.mdx#effects) |
16
+ | <a id="backend"></a> `backend` | `"webgl"` \| `"webgpu"` | Backend to render background effects | [`RendererOptions`](RendererOptions.mdx).[`backend`](RendererOptions.mdx#backend) |
17
+ | <a id="foregroundthreshold"></a> `foregroundThreshold` | `number` | [0,1] Upper mask confidence: all mask pixels >= this are considered definite foreground. Adjust to make mask edges tighter or more permissive for foreground inclusion. Example: 0.8 ("mask > 0.8 = sure foreground"). Must always be >= backgroundThreshold. **Default** `0.85` | [`RendererOptions`](RendererOptions.mdx).[`foregroundThreshold`](RendererOptions.mdx#foregroundthreshold) |
18
+ | <a id="backgroundthreshold"></a> `backgroundThreshold` | `number` | [0,1] Lower mask confidence: all mask pixels <= this are considered definite background. Adjust to make mask edges tighter or more permissive for background inclusion. Example: 0.3 ("mask < 0.3 = sure background"). **Default** `0.35` | [`RendererOptions`](RendererOptions.mdx).[`backgroundThreshold`](RendererOptions.mdx#backgroundthreshold) |
19
+ | <a id="sigmaspace"></a> `sigmaSpace` | `number` | Bilateral filter: sigma in pixel space for mask edge snapping. Controls the neighborhood/pixel distance—higher is larger window (5–10 typical). **Default** `5` | [`RendererOptions`](RendererOptions.mdx).[`sigmaSpace`](RendererOptions.mdx#sigmaspace) |
20
+ | <a id="sigmarangelo"></a> `sigmaRangeLo` | `number` | Bilateral filter: minimum sigma in color/luma (for mask interiors), [0,1]. Controls how little color difference is needed to cross-mask regions away from edge. Lower = sharper edge preservation in mask interiors. Example: 0.2 **Default** `0.2` | [`RendererOptions`](RendererOptions.mdx).[`sigmaRangeLo`](RendererOptions.mdx#sigmarangelo) |
21
+ | <a id="sigmarangehi"></a> `sigmaRangeHi` | `number` | Bilateral filter: maximum sigma in color/luma (for mask uncertain zones), [0,1]. Controls how much color similarity is required at uncertain/edge mask locations. Higher = more mask smoothing at edges. Example: 0.8 **Default** `0.8` | [`RendererOptions`](RendererOptions.mdx).[`sigmaRangeHi`](RendererOptions.mdx#sigmarangehi) |
22
+ | <a id="maskcombineratio"></a> `maskCombineRatio` | `number` | Ratio for mask smoothing (how much uncertainty enables temporal blend), [0,1]. Higher = more frame-to-frame blending, more stability but more trailing ghosts. Typical: 0.6–0.85. **Default** `0.8` | [`RendererOptions`](RendererOptions.mdx).[`maskCombineRatio`](RendererOptions.mdx#maskcombineratio) |
23
+ | <a id="excludebystanders"></a> `excludeBystanders` | `boolean` | **`Experimental`** Whether to exclude bystanders/connected people from the output mask. The main person instance (closest to personCenter OR largest blob) is kept in the output mask. All other bystanders/connected people are suppressed (bystander removal). **Default** `false (no bystander removal, all detected people are included in the mask). @experimental This feature is experimental and only works in WebGL backend.` | [`RendererOptions`](RendererOptions.mdx).[`excludeBystanders`](RendererOptions.mdx#excludebystanders) |
24
+ | <a id="personcenter"></a> `personCenter` | \[`number`, `number`\] | **`Experimental`** Person center: normalized (x, y) in [0,1] image coordinates for main subject selection. Used by the CCL/bias filter to select the main person blob. **Default** `[0.5, 0.42] (= center, slightly above vertical midpoint). @experimental This feature is experimental and only works in WebGL backend.` | [`RendererOptions`](RendererOptions.mdx).[`personCenter`](RendererOptions.mdx#personcenter) |
25
+ | <a id="morpheroderadiuspx"></a> `morphErodeRadiusPx` | `number` | **`Experimental`** Morphological erosion: radius in pixels [1,12]. Sets kernel size for bridge-breaking. Larger values break thicker bridges but may erode fine details. **Default** `5 @experimental This feature is experimental and only works in WebGL backend.` | [`RendererOptions`](RendererOptions.mdx).[`morphErodeRadiusPx`](RendererOptions.mdx#morpheroderadiuspx) |
26
+ | <a id="morphpass"></a> `morphPass` | `number` | **`Experimental`** Morphological pass: number of separable passes [1,10]. More passes increase the effective span. **Default** `4 @experimental This feature is experimental and only works in WebGL backend.` | [`RendererOptions`](RendererOptions.mdx).[`morphPass`](RendererOptions.mdx#morphpass) |
27
+ | <a id="morphdilateradiuspx"></a> `morphDilateRadiusPx` | `number` | **`Experimental`** Geodesic dilation: radius in pixels [1,12]. Must match erosion for good reconstruction. **Default** `6 @experimental This feature is experimental and only works in WebGL backend.` | [`RendererOptions`](RendererOptions.mdx).[`morphDilateRadiusPx`](RendererOptions.mdx#morphdilateradiuspx) |
28
+ | <a id="lightwrapintensity"></a> `lightWrapIntensity` | `number` | [0,1] Light wrap amount (halo intensity) at mask edge. Wraps blurred background color just outside the subject edge onto the subject boundary for realism. **Default** `0.8` | [`RendererOptions`](RendererOptions.mdx).[`lightWrapIntensity`](RendererOptions.mdx#lightwrapintensity) |
29
+ | <a id="lightwraptightness"></a> `lightWrapTightness` | `number` | [0.5,4.0] Controls power/tightness of the wrap band falloff. Higher = tighter/narrower wrap. **Default** `1.2` | [`RendererOptions`](RendererOptions.mdx).[`lightWrapTightness`](RendererOptions.mdx#lightwraptightness) |
30
+ | <a id="lightwrapedgeband"></a> `lightWrapEdgeBand` | `number` | Width of the wrap band (feather size, in normalized mask units) between the backgroundThreshold and foregroundThreshold in [0.0, (foregroundThreshold - backgroundThreshold) / 2] Higher = wider soft halo. **Default** `0.25` | [`RendererOptions`](RendererOptions.mdx).[`lightWrapEdgeBand`](RendererOptions.mdx#lightwrapedgeband) |
31
+ | <a id="lightwrapbluramount"></a> `lightWrapBlurAmount` | `number` | Blur amount used for background color in the wrap band (units=blur passes). **Default** `1` | [`RendererOptions`](RendererOptions.mdx).[`lightWrapBlurAmount`](RendererOptions.mdx#lightwrapbluramount) |
32
+ | <a id="downsamplefactor"></a> `downSampleFactor` | `number` | Downsampling factor for mask/blurring, must be [2,4]. 2 = half resolution, 4 = quarter resolution for faster filtering. Use for performance tuning vs. quality. **Default** `2` | [`RendererOptions`](RendererOptions.mdx).[`downSampleFactor`](RendererOptions.mdx#downsamplefactor) |
33
+ | <a id="segmenter"></a> `segmenter` | [`Segmenter`](Segmenter.mdx) | - | - |
34
+ | <a id="width"></a> `width` | `number` | - | - |
35
+ | <a id="height"></a> `height` | `number` | - | - |
@@ -0,0 +1,15 @@
1
+ ## Extends
2
+
3
+ - [`Weights`](Weights.mdx)
4
+
5
+ ## Properties
6
+
7
+ | Property | Type | Inherited from |
8
+ | ------ | ------ | ------ |
9
+ | <a id="iou"></a> `iou` | `number` | [`Weights`](Weights.mdx).[`iou`](Weights.mdx#iou) |
10
+ | <a id="area"></a> `area` | `number` | [`Weights`](Weights.mdx).[`area`](Weights.mdx#area) |
11
+ | <a id="height"></a> `height` | `number` | [`Weights`](Weights.mdx).[`height`](Weights.mdx#height) |
12
+ | <a id="center"></a> `center` | `number` | [`Weights`](Weights.mdx).[`center`](Weights.mdx#center) |
13
+ | <a id="centerx"></a> `centerX` | `number` | - |
14
+ | <a id="centery"></a> `centerY` | `number` | - |
15
+ | <a id="decay"></a> `decay` | `number` | - |
@@ -0,0 +1,11 @@
1
+ ## Properties
2
+
3
+ | Property | Type |
4
+ | ------ | ------ |
5
+ | <a id="sumx"></a> `sumX` | `number` |
6
+ | <a id="sumy"></a> `sumY` | `number` |
7
+ | <a id="count"></a> `count` | `number` |
8
+ | <a id="minx"></a> `minX` | `number` |
9
+ | <a id="maxx"></a> `maxX` | `number` |
10
+ | <a id="miny"></a> `minY` | `number` |
11
+ | <a id="maxy"></a> `maxY` | `number` |
@@ -0,0 +1,12 @@
1
+ ## Extended by
2
+
3
+ - [`SelectionOptions`](SelectionOptions.mdx)
4
+
5
+ ## Properties
6
+
7
+ | Property | Type |
8
+ | ------ | ------ |
9
+ | <a id="iou"></a> `iou` | `number` |
10
+ | <a id="area"></a> `area` | `number` |
11
+ | <a id="height"></a> `height` | `number` |
12
+ | <a id="center"></a> `center` | `number` |
@@ -0,0 +1,10 @@
1
+ ```ts
2
+ type OptionalKeys<T, K> = Omit<T, K> & Partial<Pick<T, K>>;
3
+ ```
4
+
5
+ ## Type Parameters
6
+
7
+ | Type Parameter |
8
+ | ------ |
9
+ | `T` |
10
+ | `K` *extends* keyof `T` |
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const BACKGROUND_THRESHOLD: 0.35 = 0.35;
3
+ ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const DOWN_SAMPLE_FACTOR: 2 = 2;
3
+ ```
@@ -1,3 +1,3 @@
1
1
  ```ts
2
- const EDGE_BLUR_AMOUNT: 3 = 3;
2
+ const EDGE_BLUR_AMOUNT: 4 = 4;
3
3
  ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const EXCLUDE_BYSTANDERS: false = false;
3
+ ```
@@ -1,3 +1,3 @@
1
1
  ```ts
2
- const FOREGROUND_THRESHOLD: 0.5 = 0.5;
2
+ const FOREGROUND_THRESHOLD: 0.85 = 0.85;
3
3
  ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const LIGHT_WRAP_BLUR_AMOUNT: 1 = 1;
3
+ ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const LIGHT_WRAP_EDGE_BAND: 0.25 = 0.25;
3
+ ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const LIGHT_WRAP_INTENSITY: 0.8 = 0.8;
3
+ ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const LIGHT_WRAP_TIGHTNESS: 1 = 1;
3
+ ```
@@ -1,3 +1,3 @@
1
1
  ```ts
2
- const MASK_COMBINE_RATIO: 0.5 = 0.5;
2
+ const MASK_COMBINE_RATIO: 0.8 = 0.8;
3
3
  ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const MORPH_DILATE_RADIUS_PX: 6 = 6;
3
+ ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const MORPH_ERODE_RADIUS_PX: 5 = 5;
3
+ ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const MORPH_PASS: 4 = 4;
3
+ ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const PERSON_CENTER: [number, number];
3
+ ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const SIGMA_RANGE: [number, number];
3
+ ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const SIGMA_SPACE: 5 = 5;
3
+ ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const STRONG_EDGE_BLUR_AMOUNT: 2 = 2;
3
+ ```
@@ -0,0 +1,14 @@
1
+ ```ts
2
+ const getCanvasRenderingContext2D: (canvas, options?) => OffscreenCanvasRenderingContext2D;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `canvas` | `OffscreenCanvas` |
10
+ | `options?` | `CanvasRenderingContext2DOptions` |
11
+
12
+ ## Returns
13
+
14
+ `OffscreenCanvasRenderingContext2D`
@@ -0,0 +1,13 @@
1
+ ```ts
2
+ const getImageSize: (image) => Size;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `image` | `CanvasImageSource` |
10
+
11
+ ## Returns
12
+
13
+ `Size`