Motion detection wrapper class, which performs motion detection and processing.

Namespace:  AForge.Vision.Motion
Assembly:  AForge.Vision (in AForge.Vision.dll) Version: (


public class MotionDetector


The class serves as a wrapper class for motion detection and motion processing algorithms, allowing to call them with single call. Unlike motion detection and motion processing interfaces, the class also provides additional methods for convenience, so the algorithms could be applied not only to UnmanagedImage, but to .NET's Bitmap class as well.

In addition to wrapping of motion detection and processing algorthms, the class provides some additional functionality. Using MotionZones property it is possible to specify set of rectangular zones to observe - only motion in these zones is counted and post procesed.

Sample usage:

// create motion detector
MotionDetector detector = new MotionDetector(
    new SimpleBackgroundModelingDetector( ),
    new MotionAreaHighlighting( ) );
// continuously feed video frames to motion detector
while ( ... )
    // process new video frame and check motion level
    if ( detector.ProcessFrame( videoFrame ) > 0.02 )
        // ring alarm or do somethng else

Inheritance Hierarchy


See Also