Class MotionHistory
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
doubleIn second, the duration of motion history you wants to keep
maxTimeDelta
doubleIn second. Any change happens between a time interval greater than this will not be considered
minTimeDelta
doubleIn 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
doubleIn second, the duration of motion history you wants to keep
maxTimeDelta
doubleIn second. Any change happens between a time interval larger than this will not be considered
minTimeDelta
doubleIn second. Any change happens between a time interval smaller than this will not be considered.
startTime
DateTimeThe start time of the motion history
Properties
Mask
The motion mask. Do not dispose this image.
public Mat Mask { get; }
Property Value
Methods
DisposeObject()
Release unmanaged resources
protected override void DisposeObject()
GetMotionComponents(IOutputArray)
Get a sequence of motion component
public Rectangle[] GetMotionComponents(IOutputArray segMask)
Parameters
segMask
IOutputArrayThe 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
IOutputArrayThe output mask of motion components
boundingRects
VectorOfRectThe 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
MatThe foreground mask used to calculate the motion info.
motionRectangle
RectangleThe rectangle area of the motion
angle
doubleThe orientation of the motion
motionPixelCount
doubleNumber 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
MatThe 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)