ILMVMtnDet Interface

This is the interface for the LEAD Video Motion Detection Filter.

Data Types

MtnDetStateConstants

typedef enum  
{ 
   MTNDET_STATE_STOPPED, 
   MTNDET_STATE_RUNNING, 
} MtnDetStateConstants; 

Lists the possible values for the State Constants.

Enumeration Description
MTNDET_STATE_STOPPED [0] The filter isn't ready to detect any motion.
MTNDET_STATE_RUNNING [1] The filter is ready to detect any motion.

Properties

Type Name Description
long Sensitivity Set the Motion sensitivity. A small value specifies high detection sensitivity (smaller changes will trigger the callback). A large value specifies low detection sensitivity (and bigger changes are needed to trigger the callback).
long ObjectSize The Minimum object size to consider as an object. The size is a percentage of the video size (width and height). If the change is in a rectangle smaller than the object size, no callback will be triggered. The allowed values are 1 to 100.
VARIANT_BOOL ViewContainingRectangle View containing rectangle around the objects. Possible values are:
• TRUE - a white rectangle will be drawn around each area where motion is detected.
• FALSE - no rectangle is drawn in the areas containing the motion.
You can locate the rectangles containing motion using the RectCount, RectLeft, RectTop, RectWidth and RectHeight properties.
VARIANT_BOOL ViewDifferenceFrames View the different frames between the current frame and the reference frame. Possible values are:
• TRUE - the unchanged area is replaced with black. The areas containing the motion will remain unchanged. This means if there is no change, the images reaching the renderer will be all black. This should not be confused with the camera not working.
• FALSE - both changed and unchanged area remain unchanged.
The exception is area covered by the rectangles if you set the ViewContainingRectangle property to TRUE.
long RectCount (read-only) Number of rectangles where motion was detected. This property is valid only while ILMVMtnDetUserCallback::CallbackProc is processed. Access this property only from inside CallbackProc. This property will throw an error if accessed any other time. This property will be updated only while the rectangle info is not locked by the LockRectangleInfo method.
long RectLeft (long lIndex) (read-only) Left rectangle position (in pixels) for rectangle lIndex in which motion has been detected. lIndex is the rectangle index and should be between 0 and RectCount 1 (inclusive). This property is valid only while ILMVMtnDetUserCallback::CallbackProc is processed. Access this property only from inside CallbackProc. This property will throw an error if accessed any other time. This property will be updated only while the rectangle info is not locked by the LockRectangleInfo method.
long RectTop(long lIndex) (read-only) Top rectangle position (in pixels) for rectangle lIndex in which motion has been detected. lIndex is the rectangle index and should be between 0 and RectCount 1 (inclusive). This property is valid only while ILMVMtnDetUserCallback::CallbackProc is processed. Access this property only from inside CallbackProc. This property will throw an error if accessed any other time. This property will be updated only while the rectangle info is not locked by the LockRectangleInfo method.
long RectWidth(long lIndex) (read-only) Width (in pixels) for rectangle lIndex in which motion has been detected. lIndex is the rectangle index and should be between 0 and RectCount 1 (inclusive). This property is valid only while ILMVMtnDetUserCallback::CallbackProc is processed. Access this property only from inside CallbackProc. This property will throw an error if accessed any other time. This property will be updated only while the rectangle info is not locked by the LockRectangleInfo method.
long RectHeight(long lIndex) (read-only) Height (in pixels) for rectangle lIndex in which motion has been detected. lIndex is the rectangle index and should be between 0 and RectCount 1 (inclusive). This property is valid only while ILMVMtnDetUserCallback::CallbackProc is processed. Access this property only from inside CallbackProc. This property will throw an error if accessed any other time. This property will be updated only while the rectangle info is not locked by the LockRectangleInfo method.
ILMVMtnDetUserCallback CallbackObj (write-only) Set the callback object pointer. If not NULL, the CallbackProc method of this interface will be called every time motion is detected. The callback will be called for every frame containing motion. For more information see the ILMVMtnDetUserCallback interface. Set to NULL (or to "Nothing" in VB) if you do not wish to receive notifications anymore. (For example, before you delete the callback object interface).
long MinStillTime The minimum length of still periods (in milliseconds). A still period of at least this length is required before motion is considered stopped. All periods without movement shorter than the minimum still time will be considered still part of the motion. You use this to keep short periods of inactivity as part of the motion. The allowed range is 0..1000000 ms (equivalent to 0..1000 sec).
long ScatteredMotionSpacing Set the maximum space between the objects boundaries to be joined in a single object. This is a percentage of the maximum expected distance between two objects. The value range between 1 to 100.
long Interval Set the time in milliseconds of the delay time between checks for motion.
long Delay Set the time in milliseconds to wait, after motion detection is triggered, before motion detection actually starts.
VARIANT_BOOL AutoStart Set the AutoStart to VARIANT_TRUE to start the motion detection process automatically considering the delay time or Set it to VARIANT_FALSE to start the process manually using the StartDetect method. The StopDetection must be called to stop the detection If the AutoStart is VARIANT_TRUE.
MtnDetStateConstants State Read only property that return the detection process state if it is running or stopped.
VARIANT_BOOL EnableRegion Enable the region of interest. The motion will be detected within the specified region.
VARIANT_BOOL InvertRegionArea Invert the region of interest. The motion will be detected outside the specified region.
long Left Set the Left region coordinates.
long Top Set the Top region coordinates.
long Right Set the Right region coordinates.
long Bottom Set the Bottom region coordinates.
VARIANT_BOOL EnableMosaic Enable the mosaic effect on the non-region of interest area.
long Mosaic Mosaic value. Value range between 1 to 64.

Methods

HRESULT ResetToDefaults();

Description

Reset all the filter's options to the default values.

Returns

Return Description
S_OK Successful.
< 0 An error occurred.

HRESULT StopDetection();

Description

Stops the motion detection process.

Returns

Return Description
S_OK Successful.
< 0 An error occurred.
VFW_E_NOT_CONNECTED An error has occurred, either the input or output pin is not connected.

HRESULT StartDetection();

Description

Starts the motion detection process.

Returns

Return Description
S_OK Successful.
< 0 An error occurred.
VFW_E_NOT_CONNECTED An error has occurred, either the input or output pin is not connected.

long LockRectangleInfo()

Description

Locks the rectangle information and prevents the motion detection filter from changing it while the application is using it.

Comments

The application should call this method while it is processing the rectangle information. Usually, the rectangle information is updated in one thread and the callback is called in another. So it is possible for the motion detection filter to update the rectangle information while the callback is being processed.

After calling this method, the following properties are not updated until UnlockRectangleInfo is called:

long RectCount
long RectLeft (long lIndex)
long RectTop(long lIndex)
long RectWidth(long lIndex) long RectHeight(long lIndex)

The method is cumulative, so if you call LockRectangleInfo twice, you must also call UnlockRectangleInfo twice.

Typical use of this method is this:

/* From the user callback */ 
LockRectangleInfo(); 
/* Examine and process each rectangle */ 
UnlockRectangleInfo(); 
/* return from the user callback */ 

Returns

The lock count (the number of times LockRectangleInfo has been called without a corresponding UnlockRectangleInfo.

long UnlockRectangleInfo()

Description

Indicates the application is not using the rectangle information properties and allows the motion detection filter to start updating the rectangle properties.

Comments

For a list of properties affected by this method, refer to LockRectangleInfo.

This method should be called once for each LockRectangleInfo() call.

Returns

The lock count. If this method returns 0, then the filter can update the rectangle information properties. If this method returns >0, then the rectangle information is still locked and will not be updated until the lock count reaches 0.

Help Version 22.0.2022.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Filters C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.