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.
Lists the possible error code values that can be returned by the CallbackProc method.
typedef [v1_enum] enum MtnCalBkErrConstants
{
MTNCALBK_ERR_SUCCESS = 0,
MTNCALBK_ERR_PRESERVEDATA = 100,
} MtnCalBkErrConstants;
Lists the possible values for the frame types.
typedef enum
{
FRAME_TYPE_STARTMOTION,
FRAME_TYPE_MOTION,
FRAME_TYPE_STARTSTILL,
FRAME_TYPE_STILL,
} FrameTypeConstants;
[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.
[1] This frame is a motion frame. The previous frame was also a motion frame.
[2] This frame is a still frame. The previous frame was a motion frame, so the motion has just stopped.
[3] This frame is a still frame. The previous frame was also a still frame.
The filter will call this method when there is an object(s) that moves on the video.
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. |
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.
The width (in pixels) of the image pointed by pFrame.
The height (in pixels) of the image pointed by pFrame.
The bits/pixel of the image pointed by pFrame. Currently, only 24-bit images are supported.
The total size (in bytes) of the data pointed by pFrame.
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).
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.
Return | Description |
---|---|
MTNCALBK_ERR_SUCCESS or MTNCALBK_ERR_PRESERVEDATA | Successful. |
HRESULT error code | Otherwise. |