|
OpenCV for Unity 3.0.0
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.12.0/index.html ) for the details of the argument of the method.
|
K-nearest neighbours - based Background/Foreground Segmentation Algorithm. More...
Public Member Functions | |
| bool | getDetectShadows () |
| Returns the shadow detection flag. | |
| double | getDist2Threshold () |
| Returns the threshold on the squared distance between the pixel and the sample. | |
| int | getHistory () |
| Returns the number of last frames that affect the background model. | |
| int | getkNNSamples () |
| Returns the number of neighbours, the k in the kNN. | |
| int | getNSamples () |
| Returns the number of data samples in the background model. | |
| double | getShadowThreshold () |
| Returns the shadow threshold. | |
| int | getShadowValue () |
| Returns the shadow value. | |
| void | setDetectShadows (bool detectShadows) |
| Enables or disables shadow detection. | |
| void | setDist2Threshold (double _dist2Threshold) |
| Sets the threshold on the squared distance. | |
| void | setHistory (int history) |
| Sets the number of last frames that affect the background model. | |
| void | setkNNSamples (int _nkNN) |
| Sets the k in the kNN. How many nearest neighbours need to match. | |
| void | setNSamples (int _nN) |
| Sets the number of data samples in the background model. | |
| void | setShadowThreshold (double threshold) |
| Sets the shadow threshold. | |
| void | setShadowValue (int value) |
| Sets the shadow value. | |
Public Member Functions inherited from OpenCVForUnity.VideoModule.BackgroundSubtractor | |
| virtual void | apply (Mat image, Mat fgmask) |
| Computes a foreground mask. | |
| virtual void | apply (Mat image, Mat fgmask, double learningRate) |
| Computes a foreground mask. | |
| virtual void | getBackgroundImage (Mat backgroundImage) |
| Computes a background image. | |
Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm | |
| virtual void | clear () |
| Clears the algorithm state. | |
| virtual bool | empty () |
| Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. | |
| virtual string | getDefaultName () |
| IntPtr | getNativeObjAddr () |
| void | save (string filename) |
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.VideoModule.BackgroundSubtractor | |
Protected Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm | |
Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject | |
| DisposableOpenCVObject () | |
| DisposableOpenCVObject (bool isEnabledDispose) | |
| DisposableOpenCVObject (IntPtr ptr) | |
| DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose) | |
| override void | Dispose (bool disposing) |
Protected Member Functions inherited from OpenCVForUnity.DisposableObject | |
| DisposableObject () | |
| DisposableObject (bool isEnabledDispose) | |
Additional Inherited Members | |
Package Functions inherited from OpenCVForUnity.VideoModule.BackgroundSubtractor | |
Package Functions inherited from OpenCVForUnity.CoreModule.Algorithm | |
Package Attributes inherited from OpenCVForUnity.DisposableOpenCVObject | |
Properties inherited from OpenCVForUnity.DisposableObject | |
| bool | IsDisposed [get, protected set] |
| bool | IsEnabledDispose [get, set] |
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.
|
static |
|
protectedvirtual |
Reimplemented from OpenCVForUnity.VideoModule.BackgroundSubtractor.
| bool OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.getDetectShadows | ( | ) |
Returns the shadow detection flag.
If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for details.
| 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.
| int OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.getHistory | ( | ) |
Returns the number of last frames that affect the background model.
| 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.
| int OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.getNSamples | ( | ) |
Returns the number of data samples in the background model.
| 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.
| 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.
| void OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.setDetectShadows | ( | bool | detectShadows | ) |
Enables or disables shadow detection.
| void OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.setDist2Threshold | ( | double | _dist2Threshold | ) |
Sets the threshold on the squared distance.
| void OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.setHistory | ( | int | history | ) |
Sets the number of last frames that affect the background model.
| void OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.setkNNSamples | ( | int | _nkNN | ) |
Sets the k in the kNN. How many nearest neighbours need to match.
| 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.
| void OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.setShadowThreshold | ( | double | threshold | ) |
Sets the shadow threshold.
| void OpenCVForUnity.VideoModule.BackgroundSubtractorKNN.setShadowValue | ( | int | value | ) |
Sets the shadow value.