createBackgroundSubtractorKNN
import { createBackgroundSubtractorKNN } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Creates KNN Background Subtractor
createBackgroundSubtractorKNN(history: number, dist2Threshold: number, detectShadows: boolean): BackgroundSubtractorKNN | null;4 available overloads
createBackgroundSubtractorKNN(): BackgroundSubtractorKNN | null;createBackgroundSubtractorKNN(history: number): BackgroundSubtractorKNN | null;createBackgroundSubtractorKNN(history: number, dist2Threshold: number): BackgroundSubtractorKNN | null;createBackgroundSubtractorKNN(history: number, dist2Threshold: number, detectShadows: boolean): BackgroundSubtractorKNN | null;historyLength of the history.
dist2ThresholdThreshold on the squared distance between the pixel and the sample to decide whether a pixel is close to that sample. This parameter does not affect the background update.
detectShadowsIf 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 BackgroundSubtractorKNN | 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.