K-nearest neigbours - based Background/Foreground Segmentation Algorithm.
More...
#include "background_segm.hpp"
K-nearest neigbours - based Background/Foreground Segmentation Algorithm.
The class implements the K-nearest neigbours background subtraction described in [Zivkovic2006] . Very efficient if number of foreground pixels is low.
◆ getDetectShadows()
virtual bool cv::BackgroundSubtractorKNN::getDetectShadows |
( |
| ) |
const |
|
pure virtual |
Returns the shadow detection flag.
If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for details.
◆ getDist2Threshold()
virtual double cv::BackgroundSubtractorKNN::getDist2Threshold |
( |
| ) |
const |
|
pure virtual |
Returns the threshold on the squared distance between the pixel and the sample.
The threshold on the squared distance between the pixel and the sample to decide whether a pixel is close to a data sample.
◆ getHistory()
virtual int cv::BackgroundSubtractorKNN::getHistory |
( |
| ) |
const |
|
pure virtual |
Returns the number of last frames that affect the background model.
◆ getkNNSamples()
virtual int cv::BackgroundSubtractorKNN::getkNNSamples |
( |
| ) |
const |
|
pure virtual |
Returns the number of neighbours, the k in the kNN.
K is the number of samples that need to be within dist2Threshold in order to decide that that pixel is matching the kNN background model.
◆ getNSamples()
virtual int cv::BackgroundSubtractorKNN::getNSamples |
( |
| ) |
const |
|
pure virtual |
Returns the number of data samples in the background model.
◆ getShadowThreshold()
virtual double cv::BackgroundSubtractorKNN::getShadowThreshold |
( |
| ) |
const |
|
pure virtual |
Returns the shadow threshold.
A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara, Detecting Moving Shadows...*, IEEE PAMI,2003.
◆ getShadowValue()
virtual int cv::BackgroundSubtractorKNN::getShadowValue |
( |
| ) |
const |
|
pure virtual |
Returns the shadow value.
Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0 in the mask always means background, 255 means foreground.
◆ setDetectShadows()
virtual void cv::BackgroundSubtractorKNN::setDetectShadows |
( |
bool |
detectShadows | ) |
|
|
pure virtual |
Enables or disables shadow detection.
◆ setDist2Threshold()
virtual void cv::BackgroundSubtractorKNN::setDist2Threshold |
( |
double |
_dist2Threshold | ) |
|
|
pure virtual |
Sets the threshold on the squared distance.
◆ setHistory()
virtual void cv::BackgroundSubtractorKNN::setHistory |
( |
int |
history | ) |
|
|
pure virtual |
Sets the number of last frames that affect the background model.
◆ setkNNSamples()
virtual void cv::BackgroundSubtractorKNN::setkNNSamples |
( |
int |
_nkNN | ) |
|
|
pure virtual |
Sets the k in the kNN. How many nearest neigbours need to match.
◆ setNSamples()
virtual void cv::BackgroundSubtractorKNN::setNSamples |
( |
int |
_nN | ) |
|
|
pure virtual |
Sets the number of data samples in the background model.
The model needs to be reinitalized to reserve memory.
◆ setShadowThreshold()
virtual void cv::BackgroundSubtractorKNN::setShadowThreshold |
( |
double |
threshold | ) |
|
|
pure virtual |
Sets the shadow threshold.
◆ setShadowValue()
virtual void cv::BackgroundSubtractorKNN::setShadowValue |
( |
int |
value | ) |
|
|
pure virtual |
The documentation for this class was generated from the following file: