ILMVMtnDetUserCallback Interface

This is a user callback interface that should be implemented to receive notifications of when motion occurs. You register the callback by setting the ILMVMtnDet::CallbackObj property. This interface has one method.

Data Types

MtnCalBkErrConstants

typedef [v1_enum] enum MtnCalBkErrConstants 
{ 
   MTNCALBK_ERR_SUCCESS = 0, 
   MTNCALBK_ERR_PRESERVEDATA = 100, 
} MtnCalBkErrConstants; 

FrameTypeConstants

typedef enum  
{ 
   FRAME_TYPE_STARTMOTION, 
   FRAME_TYPE_MOTION, 
   FRAME_TYPE_STARTSTILL, 
   FRAME_TYPE_STILL, 
} FrameTypeConstants; 

Lists the possible values for the frame types.

Enumeration Description
FRAME_TYPE_STARTMOTION [0] This frame is a motion frame. The previous frame was a still frame, so this is the first frame in which motion has been detected.
FRAME_TYPE_MOTION [1] This frame is a motion frame. The previous frame was also a motion frame.
FRAME_TYPE_STARTSTILL [2] This frame is a still frame. The previous frame was a motion frame, so the motion has just stopped.
FRAME_TYPE_STILL [3] This frame is a still frame. The previous frame was also a still frame.

Methods

HRESULT CallbackProc(long lEvent, long pFrame, long lWidth, long lHeight, long lBitCount, long lFrameSize, VARIANT_BOOL bTopDown, long *pRet);

Description

The filter will call this method when there is an object(s) that moves on the video.

Parameters

lEvent

Type of frame. This parameter tells whether the current frame is a still frame or whether motion has been detected. Possible values are:

Value Meaning
FRAME_TYPE_STARTMOTION [0] This frame is a motion frame. The previous frame was a still frame, so this is the first frame in which motion has been detected.
FRAME_TYPE_MOTION [1] This frame is a motion frame. The previous frame was also a motion frame.
FRAME_TYPE_STARTSTILL [2] This frame is a still frame. The previous frame was a motion frame, so the motion has just stopped.
FRAME_TYPE_STILL [3] This frame is a still frame. The previous frame was also a still frame.

pFrame

A valid pointer to the frame data. This contains the whole image. Any change you make to this data will be reflected in what is saved or displayed onto the screen.

lWidth

The width (in pixels) of the image pointed by pFrame.

lHeight

The height (in pixels) of the image pointed by pFrame.

lBitCount

The bits/pixel of the image pointed by pFrame. Currently, only 24-bit images are supported.

lFrameSize

The total size (in bytes) of the data pointed by pFrame.

bTopDown

TRUE if the image is top-left (the first byte represents pixel (0,0)). FALSE if the image is bottom-left (the first line in the buffer contains the last line in the image. To put it another way, first byte represents pixel (lHeight-1, 0).

Comments

A frame is considered to be a "Motion" frame if lEvent is FRAME_TYPE_STARTMOTION or FRAME_TYPE_MOTION. A frame is considered to be a "Still" frame if lEvent is FRAME_TYPE_STARTSTILL or FRAME_TYPE_STILL.

While processing this event, you can obtain the rectangles where the movement was detected using ILMVMtnDet::RectCount, ILMVMtnDet::RectLeft, ILMVMtnDet::RectTop, ILMVMtnDet::RectWidth and ILMVMtnDet::RectHeight properties. These rectangles are valid only for the motion frames. For still frames, ILMVMtnDet::RectCount will be 0.

You can access these properties ONLY while processing CallbackProc. You should not perform lengthy calculations in this callback because no other images will be processed while you are inside CallbackProc.

The user can do any effect over the frames by making changes on the frames data, in this case the callback function must return MTNCALBK_ERR_PRESERVEDATA value in order to preserve user changes.

Returns

Return Description
MTNCALBK_ERR_SUCCESS or MTNCALBK_ERR_PRESERVEDATA Successful.
HRESULT error code Otherwise.
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.