public class BackgroundSubtractorGMG extends BackgroundSubtractor
| Modifier | Constructor and Description |
|---|---|
protected |
BackgroundSubtractorGMG(long addr) |
| Modifier and Type | Method and Description |
|---|---|
static BackgroundSubtractorGMG |
__fromPtr__(long addr) |
void |
apply(Mat image,
Mat fgmask)
Computes a foreground mask.
|
void |
apply(Mat image,
Mat fgmask,
double learningRate)
Computes a foreground mask.
|
void |
apply(Mat image,
Mat knownForegroundMask,
Mat fgmask)
Computes a foreground mask with known foreground mask input.
|
void |
apply(Mat image,
Mat knownForegroundMask,
Mat fgmask,
double learningRate)
Computes a foreground mask with known foreground mask input.
|
protected void |
finalize() |
void |
getBackgroundImage(Mat backgroundImage)
Computes a background image.
|
double |
getBackgroundPrior()
Returns the prior probability that each individual pixel is a background pixel.
|
double |
getDecisionThreshold()
Returns the value of decision threshold.
|
double |
getDefaultLearningRate()
Returns the learning rate of the algorithm.
|
int |
getMaxFeatures()
Returns total number of distinct colors to maintain in histogram.
|
double |
getMaxVal()
Returns the maximum value taken on by pixels in image sequence.
|
double |
getMinVal()
Returns the minimum value taken on by pixels in image sequence.
|
int |
getNumFrames()
Returns the number of frames used to initialize background model.
|
int |
getQuantizationLevels()
Returns the parameter used for quantization of color-space.
|
int |
getSmoothingRadius()
Returns the kernel radius used for morphological operations
|
boolean |
getUpdateBackgroundModel()
Returns the status of background model update
|
void |
setBackgroundPrior(double bgprior)
Sets the prior probability that each individual pixel is a background pixel.
|
void |
setDecisionThreshold(double thresh)
Sets the value of decision threshold.
|
void |
setDefaultLearningRate(double lr)
Sets the learning rate of the algorithm.
|
void |
setMaxFeatures(int maxFeatures)
Sets total number of distinct colors to maintain in histogram.
|
void |
setMaxVal(double val)
Sets the maximum value taken on by pixels in image sequence.
|
void |
setMinVal(double val)
Sets the minimum value taken on by pixels in image sequence.
|
void |
setNumFrames(int nframes)
Sets the number of frames used to initialize background model.
|
void |
setQuantizationLevels(int nlevels)
Sets the parameter used for quantization of color-space
|
void |
setSmoothingRadius(int radius)
Sets the kernel radius used for morphological operations
|
void |
setUpdateBackgroundModel(boolean update)
Sets the status of background model update
|
clear, empty, getDefaultName, getNativeObjAddr, savepublic static BackgroundSubtractorGMG __fromPtr__(long addr)
public void apply(Mat image, Mat fgmask, double learningRate)
apply in class BackgroundSubtractorimage - Next 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.fgmask - The output foreground mask as an 8-bit binary image.learningRate - The 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.public void apply(Mat image, Mat fgmask)
apply in class BackgroundSubtractorimage - Next 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.fgmask - The output foreground mask as an 8-bit binary image.
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.public void apply(Mat image, Mat knownForegroundMask, Mat fgmask, double learningRate)
apply in class BackgroundSubtractorimage - Next video frame.fgmask - The output foreground mask as an 8-bit binary image.knownForegroundMask - The mask for inputting already known foreground.learningRate - The 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.
Note: This method has a default virtual implementation that throws a "not implemented" error.
Foreground masking may not be supported by all background subtractors.public void apply(Mat image, Mat knownForegroundMask, Mat fgmask)
apply in class BackgroundSubtractorimage - Next video frame.fgmask - The output foreground mask as an 8-bit binary image.knownForegroundMask - The mask for inputting already known foreground.
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.
Note: This method has a default virtual implementation that throws a "not implemented" error.
Foreground masking may not be supported by all background subtractors.public void getBackgroundImage(Mat backgroundImage)
BackgroundSubtractorgetBackgroundImage in class BackgroundSubtractorbackgroundImage - The output background image.
Note: Sometimes the background image can be very blurry, as it contain the average background
statistics.public int getMaxFeatures()
public void setMaxFeatures(int maxFeatures)
maxFeatures - automatically generatedpublic double getDefaultLearningRate()
public void setDefaultLearningRate(double lr)
lr - automatically generatedpublic int getNumFrames()
public void setNumFrames(int nframes)
nframes - automatically generatedpublic int getQuantizationLevels()
public void setQuantizationLevels(int nlevels)
nlevels - automatically generatedpublic double getBackgroundPrior()
public void setBackgroundPrior(double bgprior)
bgprior - automatically generatedpublic int getSmoothingRadius()
public void setSmoothingRadius(int radius)
radius - automatically generatedpublic double getDecisionThreshold()
public void setDecisionThreshold(double thresh)
thresh - automatically generatedpublic boolean getUpdateBackgroundModel()
public void setUpdateBackgroundModel(boolean update)
update - automatically generatedpublic double getMinVal()
public void setMinVal(double val)
val - automatically generatedpublic double getMaxVal()
public void setMaxVal(double val)
val - automatically generatedprotected void finalize()
throws Throwable
finalize in class BackgroundSubtractorThrowableCopyright © 2026. All rights reserved.