bgsegm_BackgroundSubtractorCNT
import { bgsegm_BackgroundSubtractorCNT } 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.
Background subtraction based on counting.
About as fast as MOG2 on a high end system. More than twice faster than MOG2 on cheap hardware (benchmarked on Raspberry Pi3).
%Algorithm by Sagi Zeevi ( https://github.com/sagi-z/BackgroundSubtractorCNT )
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
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;imageimage argument (Mat).
fgmaskOutput destination, filled by the native operation. fgmask argument (Mat).
learningRatelearning rate argument (number).
apply1
Computes a foreground mask with known foreground mask input.
Note: This method has a default virtual implementation that throws a "not impemented" error. Foreground masking may not be supported by all background subtractors.
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.
knownForegroundMaskThe mask for inputting already known foreground.
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.
getBackgroundImage
Return the background image configured on this bgsegm_BackgroundSubtractorCNT object.
getBackgroundImage(backgroundImage: Mat): void;backgroundImageOutput destination, filled by the native operation. background image argument (Mat).
getMinPixelStability
Returns number of frames with same pixel color to consider stable.
getMinPixelStability(): number;The number result.
setMinPixelStability
Sets the number of frames with same pixel color to consider stable.
setMinPixelStability(value: number): void;valuevalue argument (number).
getMaxPixelStability
Returns maximum allowed credit for a pixel in history.
getMaxPixelStability(): number;The number result.
setMaxPixelStability
Sets the maximum allowed credit for a pixel in history.
setMaxPixelStability(value: number): void;valuevalue argument (number).
getUseHistory
Returns if we're giving a pixel credit for being stable for a long time.
getUseHistory(): boolean;The boolean result.
setUseHistory
Sets if we're giving a pixel credit for being stable for a long time.
setUseHistory(value: boolean): void;valuevalue argument (boolean).
getIsParallel
Returns if we're parallelizing the algorithm.
getIsParallel(): boolean;The boolean result.
setIsParallel
Sets if we're parallelizing the algorithm.
setIsParallel(value: boolean): void;valuevalue argument (boolean).
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.