Grid structure / grid sensitivity

Prev

Next

 






































































































Grid structure.

Description

Overview
A sensitivity grid is applied on video frames. This grid allows to choose areas within the image where motion must be detected. The grid divides the image into rows and columns, defining cells. Each cell sensitivity can be set from 0 (no motion detection) to 9 (maximal motion sensitivity).

E.g. if the video frame is 320 x 240, and you specify a grid size of 32x24, each cell will have a 10x10 size.

One motion ratio is calculated per cell, and the OnMotionDetected event reports the X and Y coordinates of the cell that reported the higher motion ratio.

Common grids sizes span 2 x 2 to 30 x 30, but any grid size can be used, from 1 x 1 to the width x height size of the video frame.

The grid is defined by a simple string that can be set and retrieved by using the Grid property, allowing to easily save it and retrieve it using the registry (see Grid Structure below).

Grid setup
The sensitivity of each cell can be set programmatically by assigning the Grid property, or interactively through a dialog invoked by ShowGridDialog This dialog shows the grid superposed to the current video image, allowing to enable/disable the motion detection in each cell by clicking on the cell.

Grid structure
The grid corresponds to a division of the frame into rows and columns, equally spaced. The minimum size is 1 x 1, the maximum size is the size of the frame.
The grid divides the video frame in cells. A value associated to each cell represents the sensitivity of this cell, from 0 (no motion sensitivity) to 9 (maximal motion sensitivity).

Grids samples:

2 x 2 grid:

0 6 
6 6 


10 x 8 grid:

0 0 0 0 0 0 0 0 0 0 
7 7 7 7 7 7 7 7 7 7 
7 7 7 7 7 7 7 7 7 7 
7 7 7 7 7 7 7 7 7 7 
7 7 7 7 7 7 7 7 7 7 
7 7 7 7 7 7 7 7 7 7 
7 7 7 7 7 7 7 7 7 7 
7 7 7 7 7 7 7 7 7 7 


4 x 8 grid:

8 8 0 0 
8 8 0 0 
8 8 0 0 
8 8 0 0 
8 8 0 0 
8 8 0 0 
8 8 0 0 
8 8 0 0 



If the grid over sizes the frame (the grid has more columns that the frame width and/or more rows than the frame height, in pixels), the motion detection is done on the top/left part of the grid that covers the frame, the parts that oversize the frame are ignored, and the OnGridOversizesFrame event occurs returning the delta width and/or height in pixels that do not cover the frame.

Grid layout
The grid is set and retrieved as a linear string layout of each cell sensitivity. This layout allows to easily store the grid in the registry and retrieve it as a simple string.

The grid string begins by the 1st row, a blank separator, then the 2nd row, a blank separator, the 3rd, row, and so on. E.g., for a 10 x 10 grid :

"0000044441 5555555551 4444444441 5555555551 6666666661 66666666661 6666666661 3333333331 0000000000 0000000000"

corresponds to the following 2D grid:

0 0 0 0 0 4 4 4 4 1
5 5 5 5 5 5 5 5 5 1
4 4 4 4 4 4 4 4 4 1
5 5 5 5 5 5 5 5 5 1
6 6 6 6 6 6 6 6 6 1
6 6 6 6 6 6 6 6 6 1
6 6 6 6 6 6 6 6 6 1
3 3 3 3 3 3 3 3 3 1
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0

In this sample, the 4 top/left cells and the 2 bottom rows will not detect motion, and the most sensitive part of the frame is located on the 5th, 6th and 7th rows.



See Also
Color / Greyscale Motion ratio Recording only when motion is detected Video noise TOnMotionDetected TOnMotionNotDetected MotionDetector_CellMotionRatio MotionDetector_CompareBlue MotionDetector_CompareGreen MotionDetector_CompareRed MotionDetector_Enabled MotionDetector_EnumGridDialogControls MotionDetector_Get2DTextGrid MotionDetector_Get2DTextMotion MotionDetector_GetCellLocation MotionDetector_GetCellSensitivity MotionDetector_GetCellSize MotionDetector_GloballyIncOrDecSensitivity MotionDetector_GlobalMotionRatio MotionDetector_GreyScale MotionDetector_Grid MotionDetector_GridXCount MotionDetector_GridYCount MotionDetector_IsGridValid MotionDetector_MaxDetectionsPerSecond MotionDetector_ReduceCPULoad MotionDetector_ReduceVideoNoise MotionDetector_Reset MotionDetector_ResetGlobalSensitivity MotionDetector_SetCellSensitivity MotionDetector_SetGridSize MotionDetector_ShowGridDialog MotionDetector_Triggered MotionDetector_UseThisReferenceSample OnBacktimedFramesCountReached OnMotionDetected OnMotionNotDetected RecordingOnMotion_Enabled RecordingOnMotion_MotionThreshold RecordingOnMotion_NoMotionPauseDelayMs