OpenCV for Unity  2.6.0
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.9.0/index.html ) for the details of the argument of the method.
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
OpenCVForUnity.VideoModule.BackgroundSubtractorKNN Class Reference

K-nearest neighbours - based Background/Foreground Segmentation Algorithm. More...

Inheritance diagram for OpenCVForUnity.VideoModule.BackgroundSubtractorKNN:
OpenCVForUnity.VideoModule.BackgroundSubtractor OpenCVForUnity.CoreModule.Algorithm OpenCVForUnity.DisposableOpenCVObject OpenCVForUnity.DisposableObject

Public Member Functions

int getHistory ()
 Returns the number of last frames that affect the background model. More...
 
void setHistory (int history)
 Sets the number of last frames that affect the background model. More...
 
int getNSamples ()
 Returns the number of data samples in the background model. More...
 
void setNSamples (int _nN)
 Sets the number of data samples in the background model. More...
 
double getDist2Threshold ()
 Returns the threshold on the squared distance between the pixel and the sample. More...
 
void setDist2Threshold (double _dist2Threshold)
 Sets the threshold on the squared distance. More...
 
int getkNNSamples ()
 Returns the number of neighbours, the k in the kNN. More...
 
void setkNNSamples (int _nkNN)
 Sets the k in the kNN. How many nearest neighbours need to match. More...
 
bool getDetectShadows ()
 Returns the shadow detection flag. More...
 
void setDetectShadows (bool detectShadows)
 Enables or disables shadow detection. More...
 
int getShadowValue ()
 Returns the shadow value. More...
 
void setShadowValue (int value)
 Sets the shadow value. More...
 
double getShadowThreshold ()
 Returns the shadow threshold. More...
 
void setShadowThreshold (double threshold)
 Sets the shadow threshold. More...
 
- Public Member Functions inherited from OpenCVForUnity.VideoModule.BackgroundSubtractor
virtual void apply (Mat image, Mat fgmask, double learningRate)
 Computes a foreground mask. More...
 
virtual void apply (Mat image, Mat fgmask)
 Computes a foreground mask. More...
 
virtual void getBackgroundImage (Mat backgroundImage)
 Computes a background image. More...
 
- Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
IntPtr getNativeObjAddr ()
 
virtual void clear ()
 Clears the algorithm state. More...
 
virtual bool empty ()
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More...
 
void save (string filename)
 
virtual string getDefaultName ()
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static new BackgroundSubtractorKNN __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.VideoModule.BackgroundSubtractor
static new BackgroundSubtractor __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
static Algorithm __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

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

◆ __fromPtr__()

static new BackgroundSubtractorKNN OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.__fromPtr__ ( IntPtr  addr)
static

◆ Dispose()

override void OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.Dispose ( bool  disposing)
protectedvirtual

◆ getDetectShadows()

bool OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.getDetectShadows ( )

Returns the shadow detection flag.

If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for details.

◆ getDist2Threshold()

double OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.getDist2Threshold ( )

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 OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.getHistory ( )

Returns the number of last frames that affect the background model.

◆ getkNNSamples()

int OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.getkNNSamples ( )

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 OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.getNSamples ( )

Returns the number of data samples in the background model.

◆ getShadowThreshold()

double OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.getShadowThreshold ( )

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 OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.getShadowValue ( )

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 OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.setDetectShadows ( bool  detectShadows)

Enables or disables shadow detection.

◆ setDist2Threshold()

void OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.setDist2Threshold ( double  _dist2Threshold)

Sets the threshold on the squared distance.

◆ setHistory()

void OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.setHistory ( int  history)

Sets the number of last frames that affect the background model.

◆ setkNNSamples()

void OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.setkNNSamples ( int  _nkNN)

Sets the k in the kNN. How many nearest neighbours need to match.

◆ setNSamples()

void OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.setNSamples ( int  _nN)

Sets the number of data samples in the background model.

The model needs to be reinitalized to reserve memory.

◆ setShadowThreshold()

void OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.setShadowThreshold ( double  threshold)

Sets the shadow threshold.

◆ setShadowValue()

void OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.setShadowValue ( int  value)

Sets the shadow value.


The documentation for this class was generated from the following file: