Table of Contents

Class CudaBackgroundSubtractorMOG2

Namespace
Emgu.CV.Cuda
Assembly
Emgu.CV.dll

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 int

Length of the history.

varThreshold double

Threshold 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 bool

If 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

nint

BackgroundSubtractorPtr

Pointer to the unmanaged BackgroundSubtractor object

public nint BackgroundSubtractorPtr { get; }

Property Value

nint

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 IInputArray

Next video frame.

fgmask IOutputArray

The output forground mask

learningRate double

The learning rate, use -1.0f for default value.

stream Stream

Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).