Skip to content

MaskUploadPlugin

Segmentation mask upload plugin

Uploads segmentation mask to an image texture that can be reused by plugins next in the rendering pipeline. Uploading texture ones and reusing it speeds up rendering. Most plugins that post-process or utilize mask depend on MaskUploadPlugin and require it to be attached to renderer. Mask texture will be loaded and added to the corresponding Pose, Face, or Mask of the tracking results as maskTex field of BodyMaskTexture type. Evaluation of body segmentation mask must be enabled in @geenee/bodyprocessors!PoseProcessor#init setting @geenee/bodyprocessors!PoseParams#mask to true or @geenee/bodyprocessors!FaceProcessor#init setting @geenee/bodyprocessors!FaceParams#mask to true.

Extends

Constructors

new MaskUploadPlugin()

new MaskUploadPlugin(size): MaskUploadPlugin

Constructor

Parameters

size: Size = ...

Size of segmentation mask

Returns

MaskUploadPlugin

Overrides

Plugin.constructor

Properties

loaded

loaded: boolean

Loaded state

Inherited from

Plugin.loaded


ordinal

ordinal: number

Ordinal number

Inherited from

Plugin.ordinal


renderer?

protected optional renderer: Renderer<SegmentationResult>

Renderer loaded the plugin

Inherited from

Plugin.renderer


size

protected size: Size

Size of segmentation mask

Methods

dispose()

dispose(): void

Dispose video plugin

Returns

void

Inherited from

Plugin.dispose


load()

load(renderer): Promise<void>

Initialize plugin

Initializes texture to upload segmentation mask.

Parameters

renderer: Renderer<SegmentationResult>

Renderer this plugin is attached to

Returns

Promise<void>

Promise resolving when initialization is finished

Overrides

Plugin.load


setupCamera()

setupCamera(ratio, angle): void

Set camera parameters

Could be overridden to adjust plugin’s pipeline.

Parameters

ratio: number

Aspect ration of input video

angle: number

Vertical field of view in radians

Returns

void

Inherited from

Plugin.setupCamera


setupVideo()

setupVideo(size): void

Set video size

Could be overridden to adjust plugin’s pipeline.

Parameters

size: Size

Resolution of input video

Returns

void

Inherited from

Plugin.setupVideo


unload()

unload(): void

Reset plugin

Releases all resources and instances created in load().

Returns

void

Overrides

Plugin.unload


update()

update(result, stream): Promise<void>

Upload segmentation masks

Uploads segmentation mask to texture and adds corresponding field to results of tracking to be used by plugins next in the pipeline.

Parameters

result: SegmentationResult

Results of video processing

stream: HTMLCanvasElement

Captured video frame

Returns

Promise<void>

Overrides

Plugin.update