Skip to content

MaskUpscalePlugin

Segmentation mask upscale plugin

Performs smart upscaling of a segmentation mask on a pixel level using input image as a context provider. Increases the resolution of a segmentation mask preserving the consistency of foreground and background regions. BodyMaskHDPlugin is a processing (pre-render) stage plugin that can be attached to a @geenee/armature!ShaderRenderer. It depends on MaskUploadPlugin that must be attached to a renderer. High resolution mask will replace current maskTex within tracking results as described in MaskUploadPlugin. It can be utilized by plugins next in the rendering pipeline. Higher resolution segmentation increases quality and accuracy of partial patching and occluder components of the rendering.

new MaskUpscalePlugin(thresh, steps, size): MaskUpscalePlugin

Constructor

number = 0.55

Foreground threshold

number = 2

Number of x2 upscale steps

Size = ...

Size of input segmentation mask

MaskUpscalePlugin

Plugin.constructor

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 input segmentation mask


protected steps: number = 2

Number of x2 upscale steps


protected thresh: number = 0.55

Foreground threshold

dispose(): void

Dispose video plugin

void

Plugin.dispose


load(renderer): Promise<void>

Initialize plugin

Initializes resources required for shader effect.

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 and instances created in load().

void

Plugin.unload


update(result, stream): Promise<void>

Upscale segmentation masks

Performs smart pixel-level upscaling of a segmentation mask to a higher resolution. Replaces maskTex of tracks with HD mask.

SegmentationResult

Results of video processing

HTMLCanvasElement

Captured video frame

Promise<void>

Plugin.update