Histogram Class

Represents a bitmap histogram.

Namespace: Aurigma.GraphicsMill
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

C#
public sealed class Histogram : IDisposable

Remarks

Histograms are widely used in imaging. It is represented as an array which contains values specifying as much items as intensity levels are supported by a bitmap (i.e. for 8 bit per channel bitmaps it will be 256, for 16 bit per channel - 65356). Each histogram entry stores a number of bitmap pixels which have the same intensity level as index of this entry. For example, the first histogram entry contains a number of black pixels (i.e. pixels having zero intensity level). Entry at index 192 contains a number of pixels with intensity level equal to 192.

When Graphics Mill builds a histogram for a grayscale bitmap, it uses pixel value as an intensity level. For color bitmaps (RGB, CMYK) several algorithms for calculating intensity level of each pixel are available. Graphics Mill implements two of them:

  1. Luminosity Pixel color is converted to grayscale and this value is used as intensity level. This conversion is made by adding all channel values multiplied at weights (all weights are normalized at 1). These weights are selected with taking into consideration specifics of human vision, that's why it provides more precise result comparing to the Sum method. You can build luminosity histogram using BuildLuminosity(Bitmap) method.
  2. Sum Graphics Mill calculates sum of all channels of the pixel and divides it by the count of channels. The advantage of this method is a possibility to exclude some channel from the intensity level calculation. This way you can get a histogram, e.g., for one or two channels. This method is implemented at Adobe® Photoshop®. To build sum histogram, use some of overload of BuildSum()() method.

Histogram enables you to estimate image contrast programmatically. Also you can get some other characteristics (mean brightness, standard deviation, median, etc).

Histogram is used (explicitly or implicitly) in a number of Graphics Mill transforms, such as HistogramEqualize, Levels, BrightnessContrast (in automatic mode), etc.

Examples

C#
var histogram = bitmap.Statistics.GetSumHistogram();
for (int i = 0; i < histogram.Length; i++)
{
    Console.WriteLine(i + ": " + histogram[i]);
}

Inheritance Hierarchy

System..Object
L Aurigma.GraphicsMill..Histogram

Thread Safety

Static members of this type are not safe for multi-threaded operations. Instance members of this type are not safe for multi-threaded operations.

See Also

Reference