C# Class Accord.Imaging.ImageStatistics

Gather statistics about image in RGB color space.

The class is used to accumulate statistical values about images, like histogram, mean, standard deviation, etc. for each color channel in RGB color space.

The class accepts 8 bpp grayscale and 24/32 bpp color images for processing.

Sample usage:

// gather statistics ImageStatistics stat = new ImageStatistics( image ); // get red channel's histogram Histogram red = stat.Red; // check mean value of red channel if ( red.Mean > 128 ) { // do further processing }
Show file Open project: accord-net/framework Class Usage Examples

Public Methods

Method Description
ImageStatistics ( Bitmap image ) : System

Initializes a new instance of the ImageStatistics class.

ImageStatistics ( Bitmap image, Bitmap mask ) : System

Initializes a new instance of the ImageStatistics class.

The mask image must be a grayscale/binary (8bpp) image of the same size as the specified source image, where black pixels (value 0) correspond to areas which should be excluded from processing. So statistics is calculated only for pixels, which are none black in the mask image.

ImageStatistics ( Bitmap image, byte mask ) : System

Initializes a new instance of the ImageStatistics class.

The mask array must be of the same size as the specified source image, where 0 values correspond to areas which should be excluded from processing. So statistics is calculated only for pixels, which have none zero corresponding value in the mask.

ImageStatistics ( UnmanagedImage image ) : System

Initializes a new instance of the ImageStatistics class.

ImageStatistics ( UnmanagedImage image, UnmanagedImage mask ) : System

Initializes a new instance of the ImageStatistics class.

The mask image must be a grayscale/binary (8bpp) image of the same size as the specified source image, where black pixels (value 0) correspond to areas which should be excluded from processing. So statistics is calculated only for pixels, which are none black in the mask image.

ImageStatistics ( UnmanagedImage image, byte mask ) : System

Initializes a new instance of the ImageStatistics class.

The mask array must be of the same size as the specified source image, where 0 values correspond to areas which should be excluded from processing. So statistics is calculated only for pixels, which have none zero corresponding value in the mask.

Private Methods

Method Description
CheckMaskProperties ( PixelFormat maskFormat, Size maskSize, Size sourceImageSize ) : void
CheckSourceFormat ( PixelFormat pixelFormat ) : void
ProcessImage ( UnmanagedImage image, byte mask, int maskLineSize ) : void

Method Details

ImageStatistics() public method

Initializes a new instance of the ImageStatistics class.
Source pixel format is not supported.
public ImageStatistics ( Bitmap image ) : System
image System.Drawing.Bitmap Image to gather statistics about.
return System

ImageStatistics() public method

Initializes a new instance of the ImageStatistics class.

The mask image must be a grayscale/binary (8bpp) image of the same size as the specified source image, where black pixels (value 0) correspond to areas which should be excluded from processing. So statistics is calculated only for pixels, which are none black in the mask image.

Source pixel format is not supported. Mask image must be 8 bpp grayscale image. Mask must have the same size as the source image to get statistics for.
public ImageStatistics ( Bitmap image, Bitmap mask ) : System
image System.Drawing.Bitmap Image to gather statistics about.
mask System.Drawing.Bitmap Mask image which specifies areas to collect statistics for.
return System

ImageStatistics() public method

Initializes a new instance of the ImageStatistics class.

The mask array must be of the same size as the specified source image, where 0 values correspond to areas which should be excluded from processing. So statistics is calculated only for pixels, which have none zero corresponding value in the mask.

Source pixel format is not supported. Mask must have the same size as the source image to get statistics for.
public ImageStatistics ( Bitmap image, byte mask ) : System
image System.Drawing.Bitmap Image to gather statistics about.
mask byte Mask array which specifies areas to collect statistics for.
return System

ImageStatistics() public method

Initializes a new instance of the ImageStatistics class.
Source pixel format is not supported.
public ImageStatistics ( UnmanagedImage image ) : System
image UnmanagedImage Unmanaged image to gather statistics about.
return System

ImageStatistics() public method

Initializes a new instance of the ImageStatistics class.

The mask image must be a grayscale/binary (8bpp) image of the same size as the specified source image, where black pixels (value 0) correspond to areas which should be excluded from processing. So statistics is calculated only for pixels, which are none black in the mask image.

Source pixel format is not supported. Mask image must be 8 bpp grayscale image. Mask must have the same size as the source image to get statistics for.
public ImageStatistics ( UnmanagedImage image, UnmanagedImage mask ) : System
image UnmanagedImage Image to gather statistics about.
mask UnmanagedImage Mask image which specifies areas to collect statistics for.
return System

ImageStatistics() public method

Initializes a new instance of the ImageStatistics class.

The mask array must be of the same size as the specified source image, where 0 values correspond to areas which should be excluded from processing. So statistics is calculated only for pixels, which have none zero corresponding value in the mask.

Source pixel format is not supported. Mask must have the same size as the source image to get statistics for.
public ImageStatistics ( UnmanagedImage image, byte mask ) : System
image UnmanagedImage Image to gather statistics about.
mask byte Mask array which specifies areas to collect statistics for.
return System