Table of Contents

Class MotionHistory

Namespace
Emgu.CV
Assembly
Emgu.CV.dll

The motion history class

public class MotionHistory : DisposableObject, IDisposable
Inheritance
MotionHistory
Implements
Inherited Members

Remarks

For help on using this class, take a look at the Motion Detection example

Constructors

MotionHistory(double, double, double)

Create a motion history object

public MotionHistory(double mhiDuration, double maxTimeDelta, double minTimeDelta)

Parameters

mhiDuration double

In second, the duration of motion history you wants to keep

maxTimeDelta double

In second. Any change happens between a time interval greater than this will not be considered

minTimeDelta double

In second. Any change happens between a time interval smaller than this will not be considered.

MotionHistory(double, double, double, DateTime)

Create a motion history object

public MotionHistory(double mhiDuration, double maxTimeDelta, double minTimeDelta, DateTime startTime)

Parameters

mhiDuration double

In second, the duration of motion history you wants to keep

maxTimeDelta double

In second. Any change happens between a time interval larger than this will not be considered

minTimeDelta double

In second. Any change happens between a time interval smaller than this will not be considered.

startTime DateTime

The start time of the motion history

Properties

Mask

The motion mask. Do not dispose this image.

public Mat Mask { get; }

Property Value

Mat

Methods

DisposeObject()

Release unmanaged resources

protected override void DisposeObject()

GetMotionComponents(IOutputArray)

Get a sequence of motion component

public Rectangle[] GetMotionComponents(IOutputArray segMask)

Parameters

segMask IOutputArray

The output mask of motion components

Returns

Rectangle[]

The bounding rectangles of the motion components

GetMotionComponents(IOutputArray, VectorOfRect)

Get a sequence of motion component

public void GetMotionComponents(IOutputArray segMask, VectorOfRect boundingRects)

Parameters

segMask IOutputArray

The output mask of motion components

boundingRects VectorOfRect

The bounding rectangles of the motion components

MotionInfo(Mat, Rectangle, out double, out double)

Given a rectangle area of the motion, output the angle of the motion and the number of pixels that are considered to be motion pixel

public void MotionInfo(Mat forgroundMask, Rectangle motionRectangle, out double angle, out double motionPixelCount)

Parameters

forgroundMask Mat

The foreground mask used to calculate the motion info.

motionRectangle Rectangle

The rectangle area of the motion

angle double

The orientation of the motion

motionPixelCount double

Number of motion pixels within silhouette ROI

ReleaseManagedResources()

Release any images associated with this object

protected override void ReleaseManagedResources()

Update(Mat)

Update the motion history with the specific image and current timestamp

public void Update(Mat image)

Parameters

image Mat

The image to be added to history

Update(Mat, DateTime)

Update the motion history with the specific image and the specific timestamp

public void Update(Mat foregroundMask, DateTime timestamp)

Parameters

foregroundMask Mat

The foreground of the image to be added to history

timestamp DateTime

The time when the image is captured