bgsegm_BackgroundSubtractorGMG
import { bgsegm_BackgroundSubtractorGMG } 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 Subtractor module based on the algorithm given in [Gold2012] .
Takes a series of images and returns a sequence of mask (8UC1) images of the same size, where 255 indicates Foreground and 0 represents Background. This class implements an algorithm described in "Visual Tracking of Human Visitors under Variable-Lighting Conditions for a Responsive Audio Art Installation," A. Godbehere, A. Matsukawa, K. Goldberg, American Control Conference, Montreal, June 2012.
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 with known foreground mask input.
Note: This method has a default virtual implementation that throws a "not implemented" 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_BackgroundSubtractorGMG object.
getBackgroundImage(backgroundImage: Mat): void;backgroundImageOutput destination, filled by the native operation. background image argument (Mat).
getMaxFeatures
Returns total number of distinct colors to maintain in histogram.
getMaxFeatures(): number;The number result.
setMaxFeatures
Sets total number of distinct colors to maintain in histogram.
setMaxFeatures(maxFeatures: number): void;maxFeaturesmax features argument (number).
getDefaultLearningRate
Returns the learning rate of the algorithm.
It lies between 0.0 and 1.0. It determines how quickly features are "forgotten" from
histograms.
getDefaultLearningRate(): number;The number result.
setDefaultLearningRate
Sets the learning rate of the algorithm.
setDefaultLearningRate(lr: number): void;lrlr argument (number).
getNumFrames
Returns the number of frames used to initialize background model.
getNumFrames(): number;The number result.
setNumFrames
Sets the number of frames used to initialize background model.
setNumFrames(nframes: number): void;nframesnframes argument (number).
getQuantizationLevels
Returns the parameter used for quantization of color-space.
It is the number of discrete levels in each channel to be used in histograms.
getQuantizationLevels(): number;The number result.
setQuantizationLevels
Sets the parameter used for quantization of color-space
setQuantizationLevels(nlevels: number): void;nlevelsnlevels argument (number).
getBackgroundPrior
Returns the prior probability that each individual pixel is a background pixel.
getBackgroundPrior(): number;The number result.
setBackgroundPrior
Sets the prior probability that each individual pixel is a background pixel.
setBackgroundPrior(bgprior: number): void;bgpriorbgprior argument (number).
getSmoothingRadius
Returns the kernel radius used for morphological operations
getSmoothingRadius(): number;The number result.
setSmoothingRadius
Sets the kernel radius used for morphological operations
setSmoothingRadius(radius: number): void;radiusradius argument (number).
getDecisionThreshold
Returns the value of decision threshold.
Decision value is the value above which pixel is determined to be FG.
getDecisionThreshold(): number;The number result.
setDecisionThreshold
Sets the value of decision threshold.
setDecisionThreshold(thresh: number): void;threshthresh argument (number).
getUpdateBackgroundModel
Returns the status of background model update
getUpdateBackgroundModel(): boolean;The boolean result.
setUpdateBackgroundModel
Sets the status of background model update
setUpdateBackgroundModel(update: boolean): void;updateupdate argument (boolean).
getMinVal
Returns the minimum value taken on by pixels in image sequence. Usually 0.
getMinVal(): number;The number result.
setMinVal
Sets the minimum value taken on by pixels in image sequence.
setMinVal(val: number): void;valval argument (number).
getMaxVal
Returns the maximum value taken on by pixels in image sequence. e.g. 1.0 or 255.
getMaxVal(): number;The number result.
setMaxVal
Sets the maximum value taken on by pixels in image sequence.
setMaxVal(val: number): void;valval 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.