Skip to content

MaskFilterPlugin

Temporal filter plugin for segmentation mask

Performs temporal filtering of a segmentation mask that is based on minimization of entropy in probability space. Plugin depends on MaskUploadPlugin that must be attached to the renderer to upload mask buffer in texture. It may be combined with other mask post-processing plugins. Order in which operation on mask are applied corresponds to the order in which plugins are attached to the renderer.

new MaskFilterPlugin(alpha, size): MaskFilterPlugin

Constructor

number = 0.9

Filtering strength

Size = ...

Size of segmentation mask

MaskFilterPlugin

Plugin.constructor

protected alpha: number = 0.9

Filtering strength


loaded: boolean

Loaded state

Plugin.loaded


ordinal: number

Ordinal number

Plugin.ordinal


protected optional renderer: Renderer<SegmentationResult>

Renderer loaded the plugin

Plugin.renderer


protected size: Size

Size of segmentation mask

dispose(): void

Dispose video plugin

void

Plugin.dispose


load(renderer): Promise<void>

Initialize plugin

Initializes filter shader programs.

Renderer<SegmentationResult>

Renderer this plugin is attached to

Promise<void>

Promise resolving when initialization is finished

Plugin.load


setupCamera(ratio, angle): void

Set camera parameters

Could be overridden to adjust plugin’s pipeline.

number

Aspect ration of input video

number

Vertical field of view in radians

void

Plugin.setupCamera


setupVideo(size): void

Set video size

Could be overridden to adjust plugin’s pipeline.

Size

Resolution of input video

void

Plugin.setupVideo


unload(): void

Reset plugin

Releases all resources initialized in load().

void

Plugin.unload


update(result, stream): Promise<void>

Update segmentation masks

Filters the segmentation applying temporal smoothing. Replaces maskTex of tracks with the updated mask.

SegmentationResult

Results of video processing

HTMLCanvasElement

Captured video frame

Promise<void>

Plugin.update