C# Class Accord.Vision.Motion.GridMotionAreaProcessing

Motion processing algorithm, which performs grid processing of motion frame.

The aim of this motion processing algorithm is to do grid processing of motion frame. This means that entire motion frame is divided by a grid into certain amount of cells and the motion level is calculated for each cell. The information about each cell's motion level may be retrieved using MotionGrid property.

In addition the algorithm can highlight those cells, which have motion level above the specified threshold (see MotionAmountToHighlight property). To enable this it is required to set HighlightMotionGrid property to .

Sample usage:

// create instance of motion detection algorithm IMotionDetector motionDetector = new ... ; // create instance of motion processing algorithm GridMotionAreaProcessing motionProcessing = new GridMotionAreaProcessing( 16, 16 ); // create motion detector MotionDetector detector = new MotionDetector( motionDetector, motionProcessing ); // continuously feed video frames to motion detector while ( ... ) { // process new video frame detector.ProcessFrame( videoFrame ); // check motion level in 5th row 8th column if ( motionProcessing.MotionGrid[5, 8] > 0.15 ) { // ... } }
Inheritance: IMotionProcessing
Datei anzeigen Open project: accord-net/framework

Public Methods

Method Description
GridMotionAreaProcessing ( ) : System

Initializes a new instance of the GridMotionAreaProcessing class.

GridMotionAreaProcessing ( int gridWidth, int gridHeight ) : System

Initializes a new instance of the GridMotionAreaProcessing class.

GridMotionAreaProcessing ( int gridWidth, int gridHeight, bool highlightMotionGrid ) : System

Initializes a new instance of the GridMotionAreaProcessing class.

GridMotionAreaProcessing ( int gridWidth, int gridHeight, bool highlightMotionGrid, float motionAmountToHighlight ) : System

Initializes a new instance of the GridMotionAreaProcessing class.

ProcessFrame ( UnmanagedImage videoFrame, UnmanagedImage motionFrame ) : void

Process video and motion frames doing further post processing after performed motion detection.

Processes provided motion frame and calculates motion level for each grid's cell. In the case if HighlightMotionGrid property is set to , the cell with motion level above threshold are highlighted.

Reset ( ) : void

Reset internal state of motion processing algorithm.

The method allows to reset internal state of motion processing algorithm and prepare it for processing of next video stream or to restart the algorithm.

Method Details

GridMotionAreaProcessing() public method

Initializes a new instance of the GridMotionAreaProcessing class.
public GridMotionAreaProcessing ( ) : System
return System

GridMotionAreaProcessing() public method

Initializes a new instance of the GridMotionAreaProcessing class.
public GridMotionAreaProcessing ( int gridWidth, int gridHeight ) : System
gridWidth int Width of motion grid (see property).
gridHeight int Height of motion grid (see property).
return System

GridMotionAreaProcessing() public method

Initializes a new instance of the GridMotionAreaProcessing class.
public GridMotionAreaProcessing ( int gridWidth, int gridHeight, bool highlightMotionGrid ) : System
gridWidth int Width of motion grid (see property).
gridHeight int Height of motion grid (see property).
highlightMotionGrid bool Highlight motion regions or not (see property).
return System

GridMotionAreaProcessing() public method

Initializes a new instance of the GridMotionAreaProcessing class.
public GridMotionAreaProcessing ( int gridWidth, int gridHeight, bool highlightMotionGrid, float motionAmountToHighlight ) : System
gridWidth int Width of motion grid (see property).
gridHeight int Height of motion grid (see property).
highlightMotionGrid bool Highlight motion regions or not (see property).
motionAmountToHighlight float Motion amount to highlight cell (see property).
return System

ProcessFrame() public method

Process video and motion frames doing further post processing after performed motion detection.

Processes provided motion frame and calculates motion level for each grid's cell. In the case if HighlightMotionGrid property is set to , the cell with motion level above threshold are highlighted.

Motion frame is not 8 bpp image, but it must be so. Video frame must be 8 bpp grayscale image or 24/32 bpp color image.
public ProcessFrame ( UnmanagedImage videoFrame, UnmanagedImage motionFrame ) : void
videoFrame Accord.Imaging.UnmanagedImage Original video frame.
motionFrame Accord.Imaging.UnmanagedImage Motion frame provided by motion detection /// algorithm (see ).
return void

Reset() public method

Reset internal state of motion processing algorithm.

The method allows to reset internal state of motion processing algorithm and prepare it for processing of next video stream or to restart the algorithm.

public Reset ( ) : void
return void