www.gusucode.com > images 案例代码 matlab源码程序 > images/AdjustIntegsityValuesUsingHistrogramEqualizationExample.m
%% Adjust Intensity Values Using Histogram Equalization % This example shows how to use histogram equalization to adjust the % contrast of a grayscale image. The original image has low contrast, with % most values in the middle of the intensity range. |histeq| produces an % output image having values evenly distributed throughout the range. %% % Read an image into the workspace. I = imread('pout.tif'); %% % Display the histogram of the original image. imhist(I); %% % Adjust the contrast using histogram equalization. In this example, the % histogram equalization function, |histeq|, tries to match a flat % histogram with 64 bins, which is the default behavior. You can specify a % different histogram instead. J = histeq(I); %% % Display the contrast-adjusted image and its new histogram. figure subplot(1,2,1) imshow(J) subplot(1,2,2) imhist(J,64);