AForge.Vision.Motion.SimpleBackgroundModelingDetector.Reset C# (CSharp) Method

Reset() public method

Reset motion detector to initial state.

Resets internal state and variables of motion detection algorithm. Usually this is required to be done before processing new video source, but may be also done at any time to restart motion detection algorithm.

public Reset ( ) : void
return void
        public void Reset( )
        {
            lock ( sync )
            {
                if ( backgroundFrame != null )
                {
                    backgroundFrame.Dispose( );
                    backgroundFrame = null;
                }

                if ( motionFrame != null )
                {
                    motionFrame.Dispose( );
                    motionFrame = null;
                }

                if ( tempFrame != null )
                {
                    tempFrame.Dispose( );
                    tempFrame = null;
                }

                framesCounter = 0;
            }
        }
    }