Skip to content

createBackgroundSubtractorMOG2

Motion and trackingfunctionOpenCV 5.0.0
import { createBackgroundSubtractorMOG2 } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

Creates MOG2 Background Subtractor

createBackgroundSubtractorMOG2(history: number, varThreshold: number, detectShadows: boolean): BackgroundSubtractorMOG2 | null;
4 available overloads
createBackgroundSubtractorMOG2(): BackgroundSubtractorMOG2 | null;
createBackgroundSubtractorMOG2(history: number): BackgroundSubtractorMOG2 | null;
createBackgroundSubtractorMOG2(history: number, varThreshold: number): BackgroundSubtractorMOG2 | null;
createBackgroundSubtractorMOG2(history: number, varThreshold: number, detectShadows: boolean): BackgroundSubtractorMOG2 | null;
history

Length of the history.

varThreshold

Threshold on the squared Mahalanobis distance between the pixel and the model to decide whether a pixel is well described by the background model. This parameter does not affect the background update.

detectShadows

If true, the algorithm will detect shadows and mark them. It decreases the speed a bit, so if you do not need this feature, set the parameter to false.

Returns

The BackgroundSubtractorMOG2 | null result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.