FaceStylizer class

Performs face stylization on images.

Signature:

export declare class FaceStylizer extends VisionTaskRunner 

Extends: VisionTaskRunner

Methods

Method Modifiers Description
createFromModelBuffer(wasmFileset, modelAssetBuffer) static Initializes the Wasm runtime and creates a new Face Stylizer based on the provided model asset buffer.
createFromModelPath(wasmFileset, modelAssetPath) static Initializes the Wasm runtime and creates a new Face Stylizer based on the path to the model asset.
createFromOptions(wasmFileset, faceStylizerOptions) static Initializes the Wasm runtime and creates a new Face Stylizer from the provided options.
setOptions(options) Sets new options for the Face Stylizer.Calling setOptions() with a subset of options only affects those options. You can reset an option back to its default value by explicitly setting it to undefined.
stylize(image, callback) Performs face stylization on the provided single image and invokes the callback with result. The method returns synchronously once the callback returns. Only use this method when the FaceStylizer is created with the image running mode.
stylize(image, imageProcessingOptions, callback) Performs face stylization on the provided single image and invokes the callback with result. The method returns synchronously once the callback returns. Only use this method when the FaceStylizer is created with the image running mode.The 'imageProcessingOptions' parameter can be used to specify one or all of: - the rotation to apply to the image before performing stylization, by setting its 'rotationDegrees' property. - the region-of-interest on which to perform stylization, by setting its 'regionOfInterest' property. If not specified, the full image is used. If both are specified, the crop around the region-of-interest is extracted first, then the specified rotation is applied to the crop.
stylize(image) Performs face stylization on the provided single image and returns the result. This method creates a copy of the resulting image and should not be used in high-throughput applications. Only use this method when the FaceStylizer is created with the image running mode.
stylize(image, imageProcessingOptions) Performs face stylization on the provided single image and returns the result. This method creates a copy of the resulting image and should not be used in high-throughput applications. Only use this method when the FaceStylizer is created with the image running mode.The 'imageProcessingOptions' parameter can be used to specify one or all of: - the rotation to apply to the image before performing stylization, by setting its 'rotationDegrees' property. - the region-of-interest on which to perform stylization, by setting its 'regionOfInterest' property. If not specified, the full image is used. If both are specified, the crop around the region-of-interest is extracted first, then the specified rotation is applied to the crop.

FaceStylizer.createFromModelBuffer()

Initializes the Wasm runtime and creates a new Face Stylizer based on the provided model asset buffer.

Signature:

static createFromModelBuffer(wasmFileset: WasmFileset, modelAssetBuffer: Uint8Array): Promise<FaceStylizer>;

Parameters

Parameter Type Description
wasmFileset WasmFileset A configuration object that provides the location of the Wasm binary and its loader.
modelAssetBuffer Uint8Array A binary representation of the model.

Returns:

Promise<FaceStylizer>

FaceStylizer.createFromModelPath()

Initializes the Wasm runtime and creates a new Face Stylizer based on the path to the model asset.

Signature:

static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<FaceStylizer>;

Parameters

Parameter Type Description
wasmFileset WasmFileset A configuration object that provides the location of the Wasm binary and its loader.
modelAssetPath string The path to the model asset.

Returns:

Promise<FaceStylizer>

FaceStylizer.createFromOptions()

I