VisionTaskOptions interface

The options for configuring a MediaPipe vision task.

Signature:

export declare interface VisionTaskOptions extends TaskRunnerOptions 

Properties

Property Modifiers Type Description
canvas HTMLCanvasElement | OffscreenCanvas The canvas element to bind textures to. This has to be set for GPU processing. The task will initialize a WebGL context and throw an error if this fails (e.g. if you have already initialized a different type of context).
runningMode RunningMode The running mode of the task. Default to the image mode. Vision tasks have two running modes: 1) The image mode for processing single image inputs. 2) The video mode for processing decoded frames of a video.

VisionTaskOptions.canvas

The canvas element to bind textures to. This has to be set for GPU processing. The task will initialize a WebGL context and throw an error if this fails (e.g. if you have already initialized a different type of context).

Signature:

canvas?: HTMLCanvasElement | OffscreenCanvas;

VisionTaskOptions.runningMode

The running mode of the task. Default to the image mode. Vision tasks have two running modes: 1) The image mode for processing single image inputs. 2) The video mode for processing decoded frames of a video.

Signature:

runningMode?: RunningMode;