C# 클래스 Accord.Vision.Motion.MotionDetector

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

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 Accord.Imaging.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 } }
파일 보기 프로젝트 열기: accord-net/framework

공개 메소드들

메소드 설명
MotionDetector ( IMotionDetector detector ) : System

Initializes a new instance of the MotionDetector class.

MotionDetector ( IMotionDetector detector, IMotionProcessing processor ) : System

Initializes a new instance of the MotionDetector class.

ProcessFrame ( Bitmap videoFrame ) : float

Process new video frame.

See ProcessFrame(UnmanagedImage) for additional details.

ProcessFrame ( BitmapData videoFrame ) : float

Process new video frame.

See ProcessFrame(UnmanagedImage) for additional details.

ProcessFrame ( UnmanagedImage videoFrame ) : float

Process new video frame.

The method first of all applies motion detection algorithm to the specified video frame to calculate motion level and motion frame. After this it applies motion processing algorithm (if it was set) to do further post processing, like highlighting motion areas, counting moving objects, etc.

In the case if MotionZones property is set, this method will perform motion filtering right after motion algorithm is done and before passing motion frame to motion processing algorithm. The method does filtering right on the motion frame, which is produced by motion detection algorithm. At the same time the method recalculates motion level and returns new value, which takes motion zones into account (but the new value is not set back to motion detection algorithm' IMotionDetector.MotionLevel property).

Reset ( ) : void

Reset motion detector to initial state.

The method resets motion detection and motion processing algotithms by calling their IMotionDetector.Reset and IMotionProcessing.Reset methods.

비공개 메소드들

메소드 설명
CreateMotionZonesFrame ( ) : void

메소드 상세

MotionDetector() 공개 메소드

Initializes a new instance of the MotionDetector class.
public MotionDetector ( IMotionDetector detector ) : System
detector IMotionDetector Motion detection algorithm to apply to each video frame.
리턴 System

MotionDetector() 공개 메소드

Initializes a new instance of the MotionDetector class.
public MotionDetector ( IMotionDetector detector, IMotionProcessing processor ) : System
detector IMotionDetector Motion detection algorithm to apply to each video frame.
processor IMotionProcessing Motion processing algorithm to apply to each video frame after /// motion detection is done.
리턴 System

ProcessFrame() 공개 메소드

Process new video frame.

See ProcessFrame(UnmanagedImage) for additional details.

public ProcessFrame ( Bitmap videoFrame ) : float
videoFrame System.Drawing.Bitmap Video frame to process (detect motion in).
리턴 float

ProcessFrame() 공개 메소드

Process new video frame.

See ProcessFrame(UnmanagedImage) for additional details.

public ProcessFrame ( BitmapData videoFrame ) : float
videoFrame System.Drawing.Imaging.BitmapData Video frame to process (detect motion in).
리턴 float

ProcessFrame() 공개 메소드

Process new video frame.

The method first of all applies motion detection algorithm to the specified video frame to calculate motion level and motion frame. After this it applies motion processing algorithm (if it was set) to do further post processing, like highlighting motion areas, counting moving objects, etc.

In the case if MotionZones property is set, this method will perform motion filtering right after motion algorithm is done and before passing motion frame to motion processing algorithm. The method does filtering right on the motion frame, which is produced by motion detection algorithm. At the same time the method recalculates motion level and returns new value, which takes motion zones into account (but the new value is not set back to motion detection algorithm' IMotionDetector.MotionLevel property).

public ProcessFrame ( UnmanagedImage videoFrame ) : float
videoFrame Accord.Imaging.UnmanagedImage Video frame to process (detect motion in).
리턴 float

Reset() 공개 메소드

Reset motion detector to initial state.

The method resets motion detection and motion processing algotithms by calling their IMotionDetector.Reset and IMotionProcessing.Reset methods.

public Reset ( ) : void
리턴 void