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
|
getBackgroundImageclear, empty, getDefaultName, getNativeObjAddr, savepublic static BackgroundSubtractorMOG2 __fromPtr__(long addr)
public int getHistory()
public void setHistory(int history)
history - automatically generatedpublic int getNMixtures()
public void setNMixtures(int nmixtures)
nmixtures - automatically generatedpublic double getBackgroundRatio()
public void setBackgroundRatio(double ratio)
ratio - automatically generatedpublic double getVarThreshold()
public void setVarThreshold(double varThreshold)
varThreshold - automatically generatedpublic double getVarThresholdGen()
public void setVarThresholdGen(double varThresholdGen)
varThresholdGen - automatically generatedpublic double getVarInit()
public void setVarInit(double varInit)
varInit - automatically generatedpublic double getVarMin()
public void setVarMin(double varMin)
public double getVarMax()
public void setVarMax(double varMax)
public double getComplexityReductionThreshold()
public void setComplexityReductionThreshold(double ct)
ct - automatically generatedpublic boolean getDetectShadows()
public void setDetectShadows(boolean detectShadows)
detectShadows - automatically generatedpublic int getShadowValue()
public void setShadowValue(int value)
value - automatically generatedpublic double getShadowThreshold()
public void setShadowThreshold(double threshold)
threshold - automatically generatedpublic void apply(Mat image, Mat fgmask, double learningRate)
apply in class BackgroundSubtractorimage - 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 BackgroundSubtractorimage - 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.protected void finalize()
throws Throwable
finalize in class BackgroundSubtractorThrowableCopyright © 2021. All rights reserved.