CustomFrameDifferenceDetector Class |
Namespace: Accord.Vision.Motion
The CustomFrameDifferenceDetector type exposes the following members.
Name | Description | |
---|---|---|
CustomFrameDifferenceDetector |
Initializes a new instance of the CustomFrameDifferenceDetector class.
| |
CustomFrameDifferenceDetector(Boolean) |
Initializes a new instance of the CustomFrameDifferenceDetector class.
| |
CustomFrameDifferenceDetector(Boolean, Boolean) |
Initializes a new instance of the CustomFrameDifferenceDetector class.
|
Name | Description | |
---|---|---|
DifferenceThreshold |
Difference threshold value, [1, 255].
| |
KeepObjectsEdges |
Restore objects edges after noise suppression or not.
| |
MotionFrame |
Motion frame containing detected areas of motion.
| |
MotionLevel |
Motion level value, [0, 1].
| |
SuppressNoise |
Suppress noise in video frames or not.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ProcessFrame |
Process new video frame.
| |
Reset |
Reset motion detector to initial state.
| |
SetBackgroundFrame(Bitmap) |
Set background frame.
| |
SetBackgroundFrame(BitmapData) |
Set background frame.
| |
SetBackgroundFrame(UnmanagedImage) |
Set background frame.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
The class implements motion detection algorithm, which is based on difference of current video frame with predefined background frame. The difference frame is thresholded and the amount of difference pixels is calculated. To suppress stand-alone noisy pixels erosion morphological operator may be applied, which is controlled by SuppressNoise property.
Note |
---|
In the case if precise motion area's borders are required (for example, for further motion post processing), then KeepObjectsEdges property may be used to restore borders after noise suppression. |
Note |
---|
In the case if custom background frame is not specified by using SetBackgroundFrame(Bitmap) method, the algorithm takes first video frame as a background frame and calculates difference of further video frames with it. |
Unlike TwoFramesDifferenceDetector motion detection algorithm, this algorithm allows to identify quite clearly all objects, which are not part of the background (scene) - most likely moving objects.
Sample usage:
// create motion detector MotionDetector detector = new MotionDetector( new CustomFrameDifferenceDetector( ), 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 } }