import VideoFxConfig from './VideoFxConfig'; import { VideoFxStreamParameters } from './VideoFxStreamParameters'; /** * [[VideoFxCanvasOpsManager]] Mechanism drives the canvas based operations * for the VideoFxProcessor. This includes input stream resizing to segmentation model * dimensions and managing the canvas loading for background replacement. */ export declare class VideoFxCanvasOpsManager { private logger; private streamParameters; private inferenceCanvas; private inferenceCtx; private outputCanvas; private horizontalResizeScalar; private verticalResizeScalar; private backgroundReplacementCanvas; private backgroundReplacementImage; constructor(streamParameters: VideoFxStreamParameters, outputCanvas: HTMLCanvasElement); /** * Generate the raw image data in a format that is directly importable into * the segmentation model * @param inputCanvas * @returns ImageData */ getInferenceInputData(inputCanvas: HTMLCanvasElement): ImageData; /** * Reconfigure the canvas operations/pipeline to fit the dimensions of the new * video stream, and resize background replacement canvas. * @param streamParameters an VideoFxStreamParameters object specifying stream dimensions */ configureForStreamParameters(streamParameters: VideoFxStreamParameters): Promise; /** * Configure the inference canvas so that write operations to the canvas * result in an image resizing. */ private configureCanvasPipeline; /** * Return the background replacement canvas * @returns HTMLCanvasElement */ getBackgroundReplacementCanvas(): HTMLCanvasElement; /** * Attempt to load custom replacement background image from URL, or the default background color. * The backgroundReplacementCanvas is then set from the loaded image. * @param effectConfig */ loadReplacementBackground(effectConfig: VideoFxConfig): Promise; /** * Draw loaded image on a canvas sized to the stream parameters, which is then set to the * backgroundReplacementCanvas member variable. * @param backgroundImage */ private resizeAndSetReplacementImage; /** * Fill default color on a canvas sized to the stream parameters, which is then set to the * backgroundReplacementCanvas member variable. * @param defaultColor */ private resizeAndSetReplacementColor; /** * Attempt to load background image from URL. * @param backgroundImageURL * @returns Promise */ loadImage(backgroundImageURL: string): Promise; }