As an alternative to using
histeq, you can perform
contrast-limited adaptive histogram equalization (CLAHE) using the
adapthisteq function. While
histeq works on the
adapthisteq operates on small regions in the image,
adapthisteq enhances the contrast
of each tile, so that the histogram of the output region approximately matches a
specified histogram. After performing the equalization,
combines neighboring tiles using bilinear interpolation to eliminate artificially
To avoid amplifying any noise that might be present in the image, you can use
adapthisteq optional parameters to limit the contrast, especially
in homogeneous areas.
This example shows how to adjust the contrast in an image using CLAHE.
Read image into the workspace.
I = imread('pout.tif');
View the original image and its histogram.
figure subplot(1,2,1) imshow(I) subplot(1,2,2) imhist(I,64)
Adjust the contrast of the image using adaptive histogram equalization.
J = adapthisteq(I);
Display the contrast-adjusted image with its histogram.
figure subplot(1,2,1) imshow(J) subplot(1,2,2) imhist(J,64)