Skip to main content

Class: MaskUpscaler

@geenee/bodyrenderers-common.MaskUpscaler

Segmentation mask upscaler

Performs smart upscaling of a segmentation mask on a pixel-level using input image as context provider. Upscaler can be used to increase a segmentation mask resolution preserving foreground region consistency. Higher resolution segmentation increases accuracy of patching and occluder components of rendering pipeline.

Constructors

constructor

new MaskUpscaler()

Methods

load

load(gl): void

Initialize upscaler

Initializes shader resources required for upscaling.

Parameters

NameTypeDescription
glWebGL2RenderingContextContext where upscaler is allocated

Returns

void


mask

mask(): null | WebGLTexture

High resolution segmentation mask

Returns

null | WebGLTexture

Segmentation mask texture


unload

unload(): void

Reset upscaler

Releases all shader resources created in load().

Returns

void


upscale

upscale(mask, input): boolean

Upscale segmentation mask

Performs smart pixel-level upscaling of a segmentation mask to higher resolution.

Parameters

NameTypeDescription
maskObjectSegmentation mask
mask.boxBox-
mask.bufferUint8Array-
mask.sizeSize-
inputWebGLTextureImage texture

Returns

boolean

True on success, false otherwise