Class cv::bgsegm::BackgroundSubtractorGMG#
Background Subtractor module based on the algorithm given in [119] . View details
#include <opencv2/bgsegm.hpp>Collaboration diagram for cv::bgsegm::BackgroundSubtractorGMG:
Public Member Functions#
Public Member Functions inherited from cv::BackgroundSubtractor
Return |
Name |
Description |
|---|---|---|
|
Computes a foreground mask with known foreground mask input. |
|
|
|
Computes a foreground mask. |
|
Computes a background image. |
Public Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
Clears the algorithm state. |
|
|
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. |
|
|
Reads algorithm parameters from a file storage. |
|
|
||
|
|
|
|
Stores algorithm parameters in a file storage. |
|
|
Static Public Member Functions#
Static Public Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
|
Loads algorithm from the file. |
|
|
Loads algorithm from a String. |
|
Reads algorithm from the file node. |
Additional Inherited Members#
Protected Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
Detailed Description#
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.
Member Function Documentation#
apply()#
void cv::bgsegm::BackgroundSubtractorGMG::apply(
InputArray image,
InputArray knownForegroundMask,
OutputArray fgmask,
double learningRate = -1 )
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.
Parameters
image— 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.
apply()#
void cv::bgsegm::BackgroundSubtractorGMG::apply(
InputArray image,
OutputArray fgmask,
double learningRate = -1 )
Computes a foreground mask.
Parameters
image— 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.
getBackgroundImage()#
void cv::bgsegm::BackgroundSubtractorGMG::getBackgroundImage(OutputArray backgroundImage)
Computes a background image.
Note
Sometimes the background image can be very blurry, as it contain the average background statistics.
Parameters
backgroundImage— The output background image.
getBackgroundPrior()#
double cv::bgsegm::BackgroundSubtractorGMG::getBackgroundPrior()
Returns the prior probability that each individual pixel is a background pixel.
getDecisionThreshold()#
double cv::bgsegm::BackgroundSubtractorGMG::getDecisionThreshold()
Returns the value of decision threshold.
Decision value is the value above which pixel is determined to be FG.
getDefaultLearningRate()#
double cv::bgsegm::BackgroundSubtractorGMG::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.
getMaxFeatures()#
int cv::bgsegm::BackgroundSubtractorGMG::getMaxFeatures()
Returns total number of distinct colors to maintain in histogram.
getMaxVal()#
double cv::bgsegm::BackgroundSubtractorGMG::getMaxVal()
Returns the maximum value taken on by pixels in image sequence. e.g. 1.0 or 255.
getMinVal()#
double cv::bgsegm::BackgroundSubtractorGMG::getMinVal()
Returns the minimum value taken on by pixels in image sequence. Usually 0.
getNumFrames()#
int cv::bgsegm::BackgroundSubtractorGMG::getNumFrames()
Returns the number of frames used to initialize background model.
getQuantizationLevels()#
int cv::bgsegm::BackgroundSubtractorGMG::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.
getSmoothingRadius()#
int cv::bgsegm::BackgroundSubtractorGMG::getSmoothingRadius()
Returns the kernel radius used for morphological operations.
getUpdateBackgroundModel()#
bool cv::bgsegm::BackgroundSubtractorGMG::getUpdateBackgroundModel()
Returns the status of background model update.
setBackgroundPrior()#
void cv::bgsegm::BackgroundSubtractorGMG::setBackgroundPrior(double bgprior)
Sets the prior probability that each individual pixel is a background pixel.
setDecisionThreshold()#
void cv::bgsegm::BackgroundSubtractorGMG::setDecisionThreshold(double thresh)
Sets the value of decision threshold.
setDefaultLearningRate()#
void cv::bgsegm::BackgroundSubtractorGMG::setDefaultLearningRate(double lr)
Sets the learning rate of the algorithm.
setMaxFeatures()#
void cv::bgsegm::BackgroundSubtractorGMG::setMaxFeatures(int maxFeatures)
Sets total number of distinct colors to maintain in histogram.
setMaxVal()#
void cv::bgsegm::BackgroundSubtractorGMG::setMaxVal(double val)
Sets the maximum value taken on by pixels in image sequence.
setMinVal()#
void cv::bgsegm::BackgroundSubtractorGMG::setMinVal(double val)
Sets the minimum value taken on by pixels in image sequence.
setNumFrames()#
void cv::bgsegm::BackgroundSubtractorGMG::setNumFrames(int nframes)
Sets the number of frames used to initialize background model.
setQuantizationLevels()#
void cv::bgsegm::BackgroundSubtractorGMG::setQuantizationLevels(int nlevels)
Sets the parameter used for quantization of color-space.
setSmoothingRadius()#
void cv::bgsegm::BackgroundSubtractorGMG::setSmoothingRadius(int radius)
Sets the kernel radius used for morphological operations.
setUpdateBackgroundModel()#
void cv::bgsegm::BackgroundSubtractorGMG::setUpdateBackgroundModel(bool update)
Sets the status of background model update.
Source file#
The documentation for this class was generated from the following file:
opencv2/bgsegm.hpp