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
Name | Type | Description |
---|---|---|
gl | WebGL2RenderingContext | Context 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
Name | Type | Description |
---|---|---|
mask | Object | Segmentation mask |
mask.box | Box | - |
mask.buffer | Uint8Array | - |
mask.size | Size | - |
input | WebGLTexture | Image texture |
Returns
boolean
True on success, false otherwise