AForge.NET

Testimonials
Features
Samples
Tools
Documentation
License
Downloads
Sources
Discussions
Partners
Projects
Members
Donate

AForge.NET Framework
2.2.5 version is available!

Image Statistics

AForge.NET framework provides set of routines to calculate different type of statistics information about image, like histogram, mean color values, standard deviation, median, etc. The information may be very useful as in different type of image enhancement, as in many other image processing tasks.

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

// 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
}
RGB Histograms

Similar information may be obtained for HSL and YCbCr color spaces, using Image Statistics HSL and Image Statistics YCbCr routines.

Vertical Intensity Statistics
The routine provides information about vertical distribution of pixel intensities, which may be used to locate objects, their centers, etc.

// collect statistics
VerticalIntensityStatistics vis = new VerticalIntensityStatistics( sourceImage );
// get gray histogram (for grayscale image)
Histogram histogram = vis.Gray;
// output some histogram's information
System.Diagnostics.Debug.WriteLine( "Mean = " + histogram.Mean );
System.Diagnostics.Debug.WriteLine( "Min = " + histogram.Min );
System.Diagnostics.Debug.WriteLine( "Max = " + histogram.Max );
Vertical Intensity Statistics

Horizontal Intensity Statistics
The class provides information about horizontal distribution of pixel intensities, which may be used to locate objects, their centers, etc.

// collect statistics
HorizontalIntensityStatistics his = new HorizontalIntensityStatistics( sourceImage );
// get gray histogram (for grayscale image)
Histogram histogram = his.Gray;
// output some histogram's information
System.Diagnostics.Debug.WriteLine( "Mean = " + histogram.Mean );
System.Diagnostics.Debug.WriteLine( "Min = " + histogram.Min );
System.Diagnostics.Debug.WriteLine( "Max = " + histogram.Max );
Horizontal Intensity Statistics