This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Contrast-limited adaptive histogram equalization (CLAHE)


J = adapthisteq(I)
J = adapthisteq(I,Name,Value,...)



J = adapthisteq(I) enhances the contrast of the grayscale image I by transforming the values using contrast-limited adaptive histogram equalization (CLAHE) [1].

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.

J = adapthisteq(I,Name,Value,...) specifies any of the additional parameter/value pairs. Parameter names can be abbreviated, and case does not matter.


collapse all

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);

Read the color image into the workspace.

[X, MAP] = imread('shadow.tif');

Convert the indexed image into a truecolor (RGB) image.

RGB = ind2rgb(X,MAP);

Convert the RGB image into the L*a*b* color space.

LAB = rgb2lab(RGB);

Scale values to the range expected by the adapthisteq function, [0 1].

L = LAB(:,:,1)/100;

Perform CLAHE. Multiply the result to get back to the range used by the L*a*b* color space.

LAB(:,:,1) = adapthisteq(L,'NumTiles',...
                         [8 8],'ClipLimit',0.005)*100;

Convert the resultant image back into the RGB color space.

J = lab2rgb(LAB);

Display the original image and result.

figure, imshow(RGB); 

figure, imshow(J);

Input Arguments

collapse all

Input intensity image, specified as a numeric 2-D array.

Data Types: single | double | int16 | uint8 | uint16

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'NumTiles',[8 16] divides the image into 8 rows and 16 columns of tiles.

collapse all

Number of tiles, specified as a two-element vector of positive integers. With the original image divided into M rows and N columns of tiles, the value of 'NumTiles' is [M N]. Both M and N must be at least 2. The total number of tiles is equal to M*N.

Data Types: double

Contrast enhancement limit, specified as a real scalar in the range [0, 1]. Higher limits result in more contrast.

Data Types: double

Number of histogram bins used to build a contrast enhancing transformation, specified as a positive integer scalar. Higher values result in greater dynamic range at the cost of slower processing speed.

Data Types: double

Range of the output image data, specified as one of the following values:

'full'Limit the range to [min(I(:)) max(I(:))].
'original'Use the full range of the output class (e.g. [0 255] for uint8).

Desired histogram shape, specified as one of the following values:

'uniform'Create a flat histogram.
'rayleigh'Create a bell-shaped histogram.
'exponential'Create a curved histogram.

Distribution parameter, specified as a nonnegative real scalar. 'Alpha' is only used when 'Distribution' is set to 'rayleigh' or 'exponential'.

Data Types: double

Output Arguments

collapse all

Output intensity image, returned as a 2-D array of the same class as the input image I.


  • '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.


[1] Zuiderveld, Karel. "Contrast Limited Adaptive Histograph Equalization." Graphic Gems IV. San Diego: Academic Press Professional, 1994. 474–485.

See Also

Introduced before R2006a

Was this topic helpful?