bgsegm_BackgroundSubtractorMOG
import { bgsegm_BackgroundSubtractorMOG } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits bgsegm_BackgroundSubtractor.
Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
The class implements the algorithm described in [KB2001] .
Constructors and members
clone
Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.
clone(): this;The this result.
apply
BackgroundSubtractor interface Computes a foreground mask.
apply(image: Mat, fgmask: Mat, learningRate: number): void;2 available overloads
apply(image: Mat, fgmask: Mat): void;apply(image: Mat, fgmask: Mat, learningRate: number): void;imageNext video frame of type CV_8UC(n),CV_8SC(n),CV_16UC(n),CV_16SC(n),CV_32SC(n),CV_32FC(n),CV_64FC(n), where n is 1,2,3,4.
fgmaskOutput destination, filled by the native operation. The output foreground mask as an 8-bit binary image.
learningRateThe value between 0 and 1 that indicates how fast the background model is learnt. Negative parameter value makes the algorithm to use some automatically chosen learning rate. 0 means that the background model is not updated at all, 1 means that the background model is completely reinitialized from the last frame.
apply1
Computes a foreground mask and skips known foreground in evaluation.
apply1(image: Mat, knownForegroundMask: Mat, fgmask: Mat, learningRate: number): void;2 available overloads
apply1(image: Mat, knownForegroundMask: Mat, fgmask: Mat): void;apply1(image: Mat, knownForegroundMask: Mat, fgmask: Mat, learningRate: number): void;imageNext video frame of type CV_8UC(n),CV_8SC(n),CV_16UC(n),CV_16SC(n),CV_32SC(n),CV_32FC(n),CV_64FC(n), where n is 1,2,3,4.
knownForegroundMaskThe mask for inputting already known foreground, allows model to ignore learning known pixels.
fgmaskOutput destination, filled by the native operation. The output foreground mask as an 8-bit binary image.
learningRateThe value between 0 and 1 that indicates how fast the background model is learnt. Negative parameter value makes the algorithm to use some automatically chosen learning rate. 0 means that the background model is not updated at all, 1 means that the background model is completely reinitialized from the last frame.
getHistory
Return the history configured on this bgsegm_BackgroundSubtractorMOG object.
getHistory(): number;The number result.
setHistory
Set the history used by this bgsegm_BackgroundSubtractorMOG object.
setHistory(nframes: number): void;nframesnframes argument (number).
getNMixtures
Return the nmixtures configured on this bgsegm_BackgroundSubtractorMOG object.
getNMixtures(): number;The number result.
setNMixtures
Set the nmixtures used by this bgsegm_BackgroundSubtractorMOG object.
setNMixtures(nmix: number): void;nmixnmix argument (number).
getBackgroundRatio
Return the background ratio configured on this bgsegm_BackgroundSubtractorMOG object.
getBackgroundRatio(): number;The number result.
setBackgroundRatio
Set the background ratio used by this bgsegm_BackgroundSubtractorMOG object.
setBackgroundRatio(backgroundRatio: number): void;backgroundRatiobackground ratio argument (number).
getNoiseSigma
Return the noise sigma configured on this bgsegm_BackgroundSubtractorMOG object.
getNoiseSigma(): number;The number result.
setNoiseSigma
Set the noise sigma used by this bgsegm_BackgroundSubtractorMOG object.
setNoiseSigma(noiseSigma: number): void;noiseSigmanoise sigma argument (number).
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.