Meet us at PRINT 19. Chicago, IL. Oct. 3 - 5.
This documentation is for the old version. Go to the latest Graphics Mill docs

Histogram Class

This class represents bitmap histogram.

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

Syntax

Visual Basic
<DefaultMemberAttribute("Item")> _
Public Class Histogram _
	Inherits LockableObject _
	Implements ICloneable, IEnumerable
C#
[DefaultMemberAttribute("Item")]
public class Histogram : LockableObject, ICloneable, IEnumerable

Remarks

Histograms are widely used in imaging. It is represented as an array which has as much items as intensity levels are supported by 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, first histogram entry contains number of black pixels (i.e. pixels having zero intensity level). Entry at index 192 contains number of pixels with intensity level equal to 192.

When Graphics Mill for .NET builds a histogram for 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 for .NET implements two of them:

  1. LuminosityPixel 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. SumGraphics Mill for .NET 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(Bitmap, Boolean[]) 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 number of Graphics Mill for .NET transforms, such as HistogramEqualize, Levels, BrightnessContrast (in automatic mode), etc.

Examples

Visual Basic
Dim histogram As Aurigma.GraphicsMill.Histogram = _
 bitmap.Statistics.GetSumHistogram(False)

For i As Integer = 0 To histogram.Length - 1
    Console.WriteLine(i & ": " & histogram(i))
Next
C#
Aurigma.GraphicsMill.Histogram histogram =
    bitmap.Statistics.GetSumHistogram(false);

for (int i = 0; i < histogram.Length; i++)
{
    Console.WriteLine(i + ": " + histogram[i]);
}

Inheritance Hierarchy

System.Object
L Aurigma.GraphicsMill.LockableObject
L Aurigma.GraphicsMill.Histogram

Thread Safety

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

See Also

Reference