public ImageStatisticsYCbCr( Bitmap image, byte[,] mask )
{
CheckSourceFormat( image.PixelFormat );
CheckMaskProperties( PixelFormat.Format8bppIndexed,
new Size( mask.GetLength( 1 ), mask.GetLength( 0 ) ), new Size( image.Width, image.Height ) );
// lock bitmap data
BitmapData imageData = image.LockBits(
new Rectangle( 0, 0, image.Width, image.Height ),
ImageLockMode.ReadOnly, image.PixelFormat );
try
{
// gather statistics
unsafe
{
fixed ( byte* maskPtr = mask )
{
ProcessImage( new UnmanagedImage( imageData ), maskPtr, mask.GetLength( 1 ) );
}
}
}
finally
{
// unlock image
image.UnlockBits( imageData );
}
}