C# Class AForge.Vision.Motion.BlobCountingObjectsProcessing

Motion processing algorithm, which counts separate moving objects and highlights them.

The aim of this motion processing algorithm is to count separate objects in the motion frame, which is provided by motion detection algorithm. In the case if HighlightMotionRegions property is set to , found objects are also highlighted on the original video frame. The algorithm counts and highlights only those objects, which size satisfies MinObjectsWidth and MinObjectsHeight properties.

The motion processing algorithm is supposed to be used only with motion detection algorithms, which are based on finding difference with background frame (see SimpleBackgroundModelingDetector and CustomFrameDifferenceDetector as simple implementations) and allow extract moving objects clearly.

Sample usage:

// create instance of motion detection algorithm IMotionDetector motionDetector = new ... ; // create instance of motion processing algorithm BlobCountingObjectsProcessing motionProcessing = new BlobCountingObjectsProcessing( ); // create motion detector MotionDetector detector = new MotionDetector( motionDetector, motionProcessing ); // continuously feed video frames to motion detector while ( ... ) { // process new video frame and check motion level if ( detector.ProcessFrame( videoFrame ) > 0.02 ) { // check number of detected objects if ( motionProcessing.ObjectsCount > 1 ) { // ... } } }
Inheritance: IMotionProcessing
Datei anzeigen Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Public Methods

Method Description
BlobCountingObjectsProcessing ( ) : System

Initializes a new instance of the BlobCountingObjectsProcessing class.

BlobCountingObjectsProcessing ( bool highlightMotionRegions ) : System

Initializes a new instance of the BlobCountingObjectsProcessing class.

BlobCountingObjectsProcessing ( int minWidth, int minHeight ) : System

Initializes a new instance of the BlobCountingObjectsProcessing class.

BlobCountingObjectsProcessing ( int minWidth, int minHeight, Color highlightColor ) : System

Initializes a new instance of the BlobCountingObjectsProcessing class.

BlobCountingObjectsProcessing ( int minWidth, int minHeight, bool highlightMotionRegions ) : System

Initializes a new instance of the BlobCountingObjectsProcessing 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 counts number of separate objects, which size satisfies MinObjectsWidth and MinObjectsHeight properties. In the case if HighlightMotionRegions property is set to , the found object are also highlighted on the original video frame.

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

BlobCountingObjectsProcessing() public method

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

BlobCountingObjectsProcessing() public method

Initializes a new instance of the BlobCountingObjectsProcessing class.
public BlobCountingObjectsProcessing ( bool highlightMotionRegions ) : System
highlightMotionRegions bool Highlight motion regions or not (see property).
return System

BlobCountingObjectsProcessing() public method

Initializes a new instance of the BlobCountingObjectsProcessing class.
public BlobCountingObjectsProcessing ( int minWidth, int minHeight ) : System
minWidth int Minimum width of acceptable object (see property).
minHeight int Minimum height of acceptable object (see property).
return System

BlobCountingObjectsProcessing() public method

Initializes a new instance of the BlobCountingObjectsProcessing class.
public BlobCountingObjectsProcessing ( int minWidth, int minHeight, Color highlightColor ) : System
minWidth int Minimum width of acceptable object (see property).
minHeight int Minimum height of acceptable object (see property).
highlightColor Color Color used to highlight motion regions.
return System

BlobCountingObjectsProcessing() public method

Initializes a new instance of the BlobCountingObjectsProcessing class.
public BlobCountingObjectsProcessing ( int minWidth, int minHeight, bool highlightMotionRegions ) : System
minWidth int Minimum width of acceptable object (see property).
minHeight int Minimum height of acceptable object (see property).
highlightMotionRegions bool Highlight motion regions or not (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 counts number of separate objects, which size satisfies MinObjectsWidth and MinObjectsHeight properties. In the case if HighlightMotionRegions property is set to , the found object are also highlighted on the original video frame.

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 AForge.Imaging.UnmanagedImage Original video frame.
motionFrame AForge.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