ILMVMtnDet Interface

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

Interface 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.

If TRUE, a white rectangle will be drawn around each area where motion is detected.

If 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.

If 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.

* If 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 milli seconds of the delay time between checks for motion.

Long

Delay

Set the time in milli seconds 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.

StateConstants

State

Read only property that return the detection process state if it is running or stopped. Possible value is one of the StateConstants constants:

STATE_DETECTION_STOPPED:  The filter doesn't ready to detect any motion.

STATE_DETECTION_RUNNING:  The filter ready to detect any motion.

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.

Interface Methods:

 

long LockRectangleInfo()

Parameters

None

Description

Locks the rectangle info and prevents the motion detection filter from changing it while the application is using it. 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()

Parameters

None

Description

Indicates the application is not using the rectangle information properties and allows the motion detection filter to start updating the rectangle properties. See LockRectangleInfo for a list of properties affected by this method.

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.