Skip to main content

Class: BodyMaskHDPlugin

@geenee/bodyrenderers-common.BodyMaskHDPlugin

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. High resolution mask will be added to @geenee/bodyprocessors!Pose of tracking results and can be used by plugins next in the rendering pipeline. Higher resolution segmentation increases accuracy of patching and occluder components of the pipeline. Evaluation of body segmentation must be enabled when calling init() by setting @geenee/bodyprocessors!PoseParams#mask flag.

Hierarchy

Constructors

constructor

new BodyMaskHDPlugin()

Constructor

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<PoseResult>

Renderer loaded the plugin

Inherited from

Plugin.renderer

Methods

dispose

dispose(): void

Dispose video plugin

Returns

void

Inherited from

Plugin.dispose


load

load(renderer): Promise<void>

Initialize plugin

Initializes resources required for shader effect.

Parameters

NameTypeDescription
rendererRenderer<PoseResult>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

NameTypeDescription
rationumberAspect ration of input video
anglenumberVertical 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

NameTypeDescription
sizeSizeResolution 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>

Process the image

Performs smart pixel-level upscaling of a segmentation mask to a higher resolution. Adds evaluated HD mask to tracking results.

Parameters

NameTypeDescription
resultPoseResultResults of video processing
streamHTMLCanvasElement-

Returns

Promise<void>

True on success, false otherwise

Overrides

Plugin.update