public class BackgroundSubtractorMOG2 extends BackgroundSubtractor
Modifier | Constructor and Description |
---|---|
protected |
BackgroundSubtractorMOG2(long addr) |
Modifier and Type | Method and Description |
---|---|
static BackgroundSubtractorMOG2 |
__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.
|
protected void |
finalize() |
double |
getBackgroundRatio()
Returns the "background ratio" parameter of the algorithm
If a foreground pixel keeps semi-constant value for about backgroundRatio\*history frames, it's
considered background and added to the model as a center of a new component.
|
double |
getComplexityReductionThreshold()
Returns the complexity reduction threshold
This parameter defines the number of samples needed to accept to prove the component exists.
|
boolean |
getDetectShadows()
Returns the shadow detection flag
If true, the algorithm detects shadows and marks them.
|
int |
getHistory()
Returns the number of last frames that affect the background model
|
int |
getNMixtures()
Returns the number of gaussian components in the background model
|
double |
getShadowThreshold()
Returns the shadow threshold
A shadow is detected if pixel is a darker version of the background.
|
int |
getShadowValue()
Returns the shadow value
Shadow value is the value used to mark shadows in the foreground mask.
|
double |
getVarInit()
Returns the initial variance of each gaussian component
|
double |
getVarMax() |
double |
getVarMin() |
double |
getVarThreshold()
Returns the variance threshold for the pixel-model match
The main threshold on the squared Mahalanobis distance to decide if the sample is well described by
the background model or not.
|
double |
getVarThresholdGen()
Returns the variance threshold for the pixel-model match used for new mixture component generation
Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the
existing components (corresponds to Tg in the paper).
|
void |
setBackgroundRatio(double ratio)
Sets the "background ratio" parameter of the algorithm
|
void |
setComplexityReductionThreshold(double ct)
Sets the complexity reduction threshold
|
void |
setDetectShadows(boolean detectShadows)
Enables or disables shadow detection
|
void |
setHistory(int history)
Sets the number of last frames that affect the background model
|
void |
setNMixtures(int nmixtures)
Sets the number of gaussian components in the background model.
|
void |
setShadowThreshold(double threshold)
Sets the shadow threshold
|
void |
setShadowValue(int value)
Sets the shadow value
|
void |
setVarInit(double varInit)
Sets the initial variance of each gaussian component
|
void |
setVarMax(double varMax) |
void |
setVarMin(double varMin) |
void |
setVarThreshold(double varThreshold)
Sets the variance threshold for the pixel-model match
|
void |
setVarThresholdGen(double varThresholdGen)
Sets the variance threshold for the pixel-model match used for new mixture component generation
|
getBackgroundImage
clear, empty, getDefaultName, getNativeObjAddr, save
public static BackgroundSubtractorMOG2 __fromPtr__(long addr)
public boolean getDetectShadows()
public double getBackgroundRatio()
public double getComplexityReductionThreshold()
public double getShadowThreshold()
public double getVarInit()
public double getVarMax()
public double getVarMin()
public double getVarThreshold()
public double getVarThresholdGen()
public int getHistory()
public int getNMixtures()
public int getShadowValue()
public void apply(Mat image, Mat fgmask, double learningRate)
apply
in class BackgroundSubtractor
image
- Next video frame. Floating point frame will be used without scaling and should be in range \([0,255]\).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 BackgroundSubtractor
image
- Next video frame. Floating point frame will be used without scaling and should be in range \([0,255]\).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 setBackgroundRatio(double ratio)
ratio
- automatically generatedpublic void setComplexityReductionThreshold(double ct)
ct
- automatically generatedpublic void setDetectShadows(boolean detectShadows)
detectShadows
- automatically generatedpublic void setHistory(int history)
history
- automatically generatedpublic void setNMixtures(int nmixtures)
nmixtures
- automatically generatedpublic void setShadowThreshold(double threshold)
threshold
- automatically generatedpublic void setShadowValue(int value)
value
- automatically generatedpublic void setVarInit(double varInit)
varInit
- automatically generatedpublic void setVarMax(double varMax)
public void setVarMin(double varMin)
public void setVarThreshold(double varThreshold)
varThreshold
- automatically generatedpublic void setVarThresholdGen(double varThresholdGen)
varThresholdGen
- automatically generatedprotected void finalize() throws Throwable
finalize
in class BackgroundSubtractor
Throwable
Generated on Wed Oct 9 2019 23:24:43 UTC / OpenCV 4.1.2