Class cv::BackgroundSubtractorKNN#
K-nearest neighbours - based Background/Foreground Segmentation Algorithm. View details
#include <opencv2/video/background_segm.hpp>Collaboration diagram for cv::BackgroundSubtractorKNN:
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#
K-nearest neighbours - based Background/Foreground Segmentation Algorithm.
The class implements the K-nearest neighbours background subtraction described in Zivkovic2006 . Very efficient if number of foreground pixels is low.
Member Function Documentation#
getDetectShadows()#
bool cv::BackgroundSubtractorKNN::getDetectShadows()
Python:
cv.BackgroundSubtractorKNN.getDetectShadows() -> retval
Returns the shadow detection flag.
If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for details.
getDist2Threshold()#
double cv::BackgroundSubtractorKNN::getDist2Threshold()
Python:
cv.BackgroundSubtractorKNN.getDist2Threshold() -> retval
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()#
int cv::BackgroundSubtractorKNN::getHistory()
Python:
cv.BackgroundSubtractorKNN.getHistory() -> retval
Returns the number of last frames that affect the background model.
getkNNSamples()#
int cv::BackgroundSubtractorKNN::getkNNSamples()
Python:
cv.BackgroundSubtractorKNN.getkNNSamples() -> retval
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()#
int cv::BackgroundSubtractorKNN::getNSamples()
Python:
cv.BackgroundSubtractorKNN.getNSamples() -> retval
Returns the number of data samples in the background model.
getShadowThreshold()#
double cv::BackgroundSubtractorKNN::getShadowThreshold()
Python:
cv.BackgroundSubtractorKNN.getShadowThreshold() -> retval
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()#
int cv::BackgroundSubtractorKNN::getShadowValue()
Python:
cv.BackgroundSubtractorKNN.getShadowValue() -> retval
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()#
void cv::BackgroundSubtractorKNN::setDetectShadows(bool detectShadows)
Python:
cv.BackgroundSubtractorKNN.setDetectShadows(detectShadows)
Enables or disables shadow detection.
setDist2Threshold()#
void cv::BackgroundSubtractorKNN::setDist2Threshold(double _dist2Threshold)
Python:
cv.BackgroundSubtractorKNN.setDist2Threshold(_dist2Threshold)
Sets the threshold on the squared distance.
setHistory()#
void cv::BackgroundSubtractorKNN::setHistory(int history)
Python:
cv.BackgroundSubtractorKNN.setHistory(history)
Sets the number of last frames that affect the background model.
setkNNSamples()#
void cv::BackgroundSubtractorKNN::setkNNSamples(int _nkNN)
Python:
cv.BackgroundSubtractorKNN.setkNNSamples(_nkNN)
Sets the k in the kNN. How many nearest neighbours need to match.
setNSamples()#
void cv::BackgroundSubtractorKNN::setNSamples(int _nN)
Python:
cv.BackgroundSubtractorKNN.setNSamples(_nN)
Sets the number of data samples in the background model.
The model needs to be reinitialized to reserve memory.
setShadowThreshold()#
void cv::BackgroundSubtractorKNN::setShadowThreshold(double threshold)
Python:
cv.BackgroundSubtractorKNN.setShadowThreshold(threshold)
Sets the shadow threshold.
setShadowValue()#
void cv::BackgroundSubtractorKNN::setShadowValue(int value)
Python:
cv.BackgroundSubtractorKNN.setShadowValue(value)
Sets the shadow value.
Source file#
The documentation for this class was generated from the following file:
opencv2/video/background_segm.hpp