Class CudaBackgroundSubtractorMOG2
Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
public class CudaBackgroundSubtractorMOG2 : SharedPtrObject, IDisposable, IBackgroundSubtractor, IAlgorithm
- Inheritance
-
CudaBackgroundSubtractorMOG2
- Implements
- Inherited Members
- Extension Methods
Constructors
CudaBackgroundSubtractorMOG2(int, double, bool)
Create a Gaussian Mixture-based Background/Foreground Segmentation model
public CudaBackgroundSubtractorMOG2(int history = 500, double varThreshold = 16, bool detectShadows = true)
Parameters
history
intLength of the history.
varThreshold
doubleThreshold on the squared Mahalanobis distance between the pixel and the model to decide whether a pixel is well described by the background model. This parameter does not affect the background update.
detectShadows
boolIf true, the algorithm will detect shadows and mark them. It decreases the speed a bit, so if you do not need this feature, set the parameter to false.
Properties
AlgorithmPtr
Pointer to the unmanaged Algorithm object
public nint AlgorithmPtr { get; }
Property Value
BackgroundSubtractorPtr
Pointer to the unmanaged BackgroundSubtractor object
public nint BackgroundSubtractorPtr { get; }
Property Value
Methods
DisposeObject()
Release all the unmanaged resource associated with this object
protected override void DisposeObject()
Update(IInputArray, IOutputArray, double, Stream)
Updates the background model
public void Update(IInputArray frame, IOutputArray fgmask, double learningRate, Stream stream = null)
Parameters
frame
IInputArrayNext video frame.
fgmask
IOutputArrayThe output forground mask
learningRate
doubleThe learning rate, use -1.0f for default value.
stream
StreamUse a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).