SegmentationParams
Options controlling the rendering and effects for person/background segmentation. All values are stable per-frame and can be safely updated in real-time.
Extends
Properties
| Property | Type | Description | Inherited from |
|---|---|---|---|
backgroundImageUrl | string | URL or Data URI for the virtual background image (used in "overlay" effect). | RendererOptions.backgroundImageUrl |
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.backgroundBlurAmount |
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.edgeBlurAmount |
effects | "blur" | "none" | "overlay" | Effects to apply: "none", "blur", or "overlay". "blur" = background blur. "overlay" = replace BG with backgroundImageUrl. | RendererOptions.effects |
backend | "webgl" | "webgpu" | Backend to render background effects | RendererOptions.backend |
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.foregroundThreshold |
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.backgroundThreshold |
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.sigmaSpace |
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.sigmaRangeLo |
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.sigmaRangeHi |
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.maskCombineRatio |
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.excludeBystanders |
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.personCenter |
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.morphErodeRadiusPx |
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.morphPass |
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.morphDilateRadiusPx |
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.lightWrapIntensity |
lightWrapTightness | number | [0.5,4.0] Controls power/tightness of the wrap band falloff. Higher = tighter/narrower wrap. Default 1.2 | RendererOptions.lightWrapTightness |
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.lightWrapEdgeBand |
lightWrapBlurAmount | number | Blur amount used for background color in the wrap band (units=blur passes). Default 1 | RendererOptions.lightWrapBlurAmount |
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.downSampleFactor |
segmenter | Segmenter | - | - |
width | number | - | - |
height | number | - | - |