Motion detection
Overview
Motion detection is enabled when MotionDetector_Enabled is true. The frame grabber must be enabled to use this feature.
With 4K / 8K video clips, enable MotionDetector_Enabled before invoking OpenPlayer: the motion detector needs RGB frames, while these clips are played in NV12 by default (see 4K and 8K playback). When enabled during the playback, it takes effect when the clip is opened again.
When motion detection is enabled, TVideoGrabber compares the last video frame received to the previous one, unless a reference sample has been specified with MotionDetector_UseThisReferenceSample.
For each video frame, if motion is detected, the OnMotionDetected event occurs and returns a global motion ratio, which depends on the number of cells in which motion has been detected and on the level of motion in each cell.
If no motion is detected, the OnMotionNotDetected event occurs.
Areas in which motion can be detected
To make it possible to limit motion detection to some areas of the video frames, the video frame is divided into a grid of rows and columns, which defines cells, each having a motion level.
In each cell, the motion level can be set in a range from 1 (minimal motion sensitivity) to 9 (maximal motion sensitivity). A value of 0 disables motion detection in the cell.
This is explained in the Grid structure / grid sensitivity chapter.
Triggered motion detection
By default, motion detection occurs for each video frame.
To trigger the motion detection manually, enable the MotionDetector_Triggered property, then invoke MotionDetector_TriggerNow during preview, recording or playback: each call triggers one motion detection, on the next video frame.
Detection of the video signal
To detect whether the video signal is present or not for each video frame, invoke IsVideoSignalDetected.