Contrast-limited adaptive histogram equalization (CLAHE)
J = adapthisteq(I)
J = adapthisteq(I,param1,val1,param2,val2...)
CLAHE operates on small regions in the image, called tiles, rather than the entire image. Each tile's contrast is enhanced, so that the histogram of the output region approximately matches the histogram specified by the 'Distribution' parameter. The neighboring tiles are then combined using bilinear interpolation to eliminate artificially induced boundaries. The contrast, especially in homogeneous areas, can be limited to avoid amplifying any noise that might be present in the image.
Two-element vector of positive integers specifying the number of tiles by row and column, [M N]. Both M and N must be at least 2. The total number of tiles is equal to M*N.
Default: [8 8]
Real scalar in the range [0 1] that specifies a contrast enhancement limit. Higher numbers result in more contrast.
Positive integer scalar specifying the number of bins for the histogram used in building a contrast enhancing transformation. Higher values result in greater dynamic range at the cost of slower processing speed.
String specifying the range of the output image data.
'original' — Range is limited to the range of the original image, [min(I(:)) max(I(:))].
'full' — Full range of the output image class is used. For example, for uint8 data, range is [0 255].
String specifying the desired histogram shape for the image tiles.
'uniform' — Flat histogram
'rayleigh' — Bell-shaped histogram
'exponential' — Curved histogram
Nonnegative real scalar specifying a distribution parameter.
Grayscale image I can be of class uint8, uint16, int16, single, or double. The output image J has the same class as I.
Apply Contrast-limited Adaptive Histogram Equalization (CLAHE) to an image and display the results.
I = imread('tire.tif'); A = adapthisteq(I,'clipLimit',0.02,'Distribution','rayleigh'); figure, imshow(I); figure, imshow(A);
Apply CLAHE to a color image.
[X MAP] = imread('shadow.tif'); % Convert indexed image to true-color (RGB) format RGB = ind2rgb(X,MAP); % Convert image to L*a*b* color space cform2lab = makecform('srgb2lab'); LAB = applycform(RGB, cform2lab); % Scale values to range from 0 to 1 L = LAB(:,:,1)/100; % Perform CLAHE LAB(:,:,1) = adapthisteq(L,'NumTiles',... [8 8],'ClipLimit',0.005)*100; % Convert back to RGB color space cform2srgb = makecform('lab2srgb'); J = applycform(LAB, cform2srgb); % Display the results figure, imshow(RGB); figure, imshow(J);
'NumTiles' specifies the number of rectangular contextual regions (tiles) into which adapthisteq divides the image. adapthisteq calculates the contrast transform function for each of these regions individually. The optimal number of tiles depends on the type of the input image, and it is best determined through experimentation.
'ClipLimit' is a contrast factor that prevents over-saturation of the image specifically in homogeneous areas. These areas are characterized by a high peak in the histogram of the particular image tile due to many pixels falling inside the same gray level range. Without the clip limit, the adaptive histogram equalization technique could produce results that, in some cases, are worse than the original image.
'Distribution' specifies the distribution that adapthisteq uses as the basis for creating the contrast transform function. The distribution you select should depend on the type of the input image. For example, underwater imagery appears to look more natural when the Rayleigh distribution is used.
 Zuiderveld, Karel. "Contrast Limited Adaptive Histograph Equalization." Graphic Gems IV. San Diego: Academic Press Professional, 1994. 474–485.