The class implements motion detection algorithm, which is based on difference of current video frame with modeled background frame. The
As the first approximation of background frame, the first frame of video stream is taken. During further video processing the background frame is constantly updated, so it changes in the direction to decrease difference with current video frame (the background frame is moved towards current frame). See FramesPerBackgroundUpdate MillisecondsPerBackgroundUpdate properties, which control the rate of background frame update.
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. And unlike CustomFrameDifferenceDetector motion detection algorithm, this algorithm includes background adaptation feature, which allows it to update its modeled background frame in order to take scene changes into account.
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 } }