Core Optical, Inc.
HistogramProcessor AdaptivelyEqualizeHistogramInPlace Method Industrial Strength, Scientific Grade
Applies the Contrast-Limited Adaptive Histogram Equalization algorithm in-place to the source data.

Namespace: PrecisionImage.HistogramProcessing
Assembly: PrecisionImage (in PrecisionImage.dll) Version: (

public void AdaptivelyEqualizeHistogramInPlace(
	SourceData sourceData,
	int channel,
	int windowSize,
	float clipping,
	Int32Rect regionOfInterest = null,
	BinaryMask binaryMask = null


Type: PrecisionImage SourceData
A SourceData type containing the image data.
Type: OnlineSystem Int32
An OnlineInt32 type indicating the data channel to process.
Type: OnlineSystem Int32
An OnlineInt32 type specifying the dimension (square) of the neighborhood window. If an even number is specified then this value is automatically shifted to the next higher odd number in order to properly center the local analysis window. Avoid a dimension smaller than the root of the histogram resolution (in this case 16). A good starting value is 55.
Type: OnlineSystem Single
A OnlineSingle type indicating the normalized (0.0 - 1.0) clipping value. Smaller values cause greater noise suppression, larger values cause greater contrast enhancement.
regionOfInterest (Optional)
Type: OnlineSystem.Windows Int32Rect
An OnlineInt32Rect type indicating the region of interest. Coordinates are zero-index based. This parameter is optional and defaults to the entire image.
binaryMask (Optional)
Type: PrecisionImage.BinarizationAndMorphology BinaryMask
A BinaryMask type specifying a mask indicating areas of the image to bypass. Masked data points are not altered and do not contribute to the local histogram statistics. This parameter is optional.

OnlineSystem ArgumentNullException Thrown when sourceData is null.
OnlineSystem ArgumentOutOfRangeException Thrown when channel is negative or out of range.
OnlineSystem ArgumentOutOfRangeException Thrown when windowSize is less than or equal to zero.
OnlineSystem ArgumentOutOfRangeException Thrown when the number of rows and/or columns in binaryMask do not match those of sourceData.
OnlineSystem ArgumentOutOfRangeException Thrown when clipping is negative or greater than 1.0.
OnlineSystem ArgumentOutOfRangeException Thrown when regionOfInterest specifies a rectangular region not completely contained within the dimensions of the source data.

This method applies the Contrast-Limited Adaptive Histogram Equalization (CLAHE) algorithm to the data contained within the specified channel of sourceData in-place. The algorithm is a derivative of the traditional Histogram Equalization algorithm, the difference being that instead of using the entire image as the source of the histogram-equalized mapping function, a smaller neighborhood of pixels is used to generate/apply the mapping function at multiple locations. A second difference is the incorporation of a contrast-limiting clipping level that prevents over-amplification of noise in uniform areas of the image. The implementation in PrecisionImage.NET is a complete sampling implementation i.e. a local window is centered at every data point in the image (or region of interest) and the CLAHE mapping function is computed and applied to the central data point. If a region of interest is specified, the data is equalized within the region of interest min/max values. Otherwise the data is equalized within the min/max values of the entire image.

This function can be used with or without a BinaryMask. If a BinaryMask is used, the data underlying any masked region will contribute to the local histogram, but only data points that aren't masked are altered (i.e. masked data points are bypassed but their values still contribute to local histograms).

The CLAHE algorithm is not a well-behaved algorithm in the sense that the clipping strategy does not deal well with sparse histograms. For this reason the implementation in PrecisionImage.NET is limited to an internal histogram resolution of 8-bit.

See Also