public void SetBackgroundFrame( UnmanagedImage backgroundFrame )
{
// reset motion detection algorithm
Reset( true );
lock ( sync )
{
// save image dimension
width = backgroundFrame.Width;
height = backgroundFrame.Height;
// alocate memory for previous and current frames
this.backgroundFrame = UnmanagedImage.Create( width, height, PixelFormat.Format8bppIndexed );
frameSize = this.backgroundFrame.Stride * height;
// convert source frame to grayscale
Tools.ConvertToGrayscale( backgroundFrame, this.backgroundFrame );
manuallySetBackgroundFrame = true;
}
}
}