ADAPT_HIST_EQUAL

The ADAPT_HIST_EQUAL function performs adaptive histogram equalization, a form of automatic image contrast enhancement. The algorithm is described in Pizer et. al., “Adaptive Histogram Equalization and its Variations.”, Computer Vision, Graphics and Image Processing, 39:355-368. Adaptive histogram equalization involves applying contrast enhancement based on the local region surrounding each pixel. Each pixel is mapped to an intensity proportional to its rank within the surrounding neighborhood. This method of automatic contrast enhancement has proven to be broadly applicable to a wide range of images and to have demonstrated effectiveness.

This routine is written in the IDL language. Its source code can be found in the file adapt_hist_equal.pro in the lib subdirectory of the IDL distribution.

Examples

The following code snippet reads a data file in the examples/data subdirectory of the IDL distribution containing a cerebral angiogram, and then displays both the original image and the adaptive histogram equalized image:

OPENR, 1, FILEPATH('cereb.dat', $

   SUBDIRECTORY=['examples','data'])



;Image size = 512 x 512

a = BYTARR(512,512, /NOZERO)



;Read it

READU, 1, a

CLOSE, 1



; Reduce size of image for comparison

a = CONGRID(a, 256,256)



;Show original

TVSCL, a, 0



;Show processed

TV, ADAPT_HIST_EQUAL(a, TOP=!D.TABLE_SIZE-1), 1

Note: Also see “Working with Histograms” (Chapter 8, Image Processing in IDL in the help/pdf directory of your IDL installation).

Syntax

Result = ADAPT_HIST_EQUAL (Image [, CLIP=value] [, FCN=vector] [, NREGIONS=nregions] [, TOP=value] )

Return Value

The result of the function is a byte image with the same dimensions as the input image parameter.

Arguments

Image

A two-dimensional array representing the image for which adaptive histogram equalization is to be performed. This parameter is interpreted as unsigned 8-bit data, so be sure that the input values are properly scaled into the range of 0 to 255.

Keywords

CLIP

Set this keyword to a nonzero value to clip the histogram by limiting its slope to the given CLIP value, thereby limiting contrast. For example, if CLIP is set to 3, the slope of the histogram is limited to 3. By default, the slope and/or contrast is not limited. Noise over-enhancement in nearly homogeneous regions is reduced by setting this parameter to values larger than 1.0.

FCN

Set this keyword to the desired cumulative probability distribution function in the form of a 256 element vector. If omitted, a linear ramp, which yields equal probability bins results. This function is later normalized, so magnitude is inconsequential, though should increase monotonically.

NREGIONS

Set this keyword to the size of the overlapped tiles, as a fraction of the largest dimensions of the image size. The default is 12, which makes each tile 1/12 the size of the largest image dimension.

TOP

Set this keyword to the maximum value of the scaled output array. The default is 255.

Version History

5.3

Introduced

See Also

H_EQ_CT, H_EQ_INT, HIST_2D, HIST_EQUAL, HISTOGRAM