www.gusucode.com > images 案例代码 matlab源码程序 > images/PlotTransformationCurveForHistogramEqualizationExample.m

    %% Plot Transformation Curve for Histogram Equalization
% This example shows how to plot the transformation curve for histogram
% equalization. |histeq| can return a 1-by-256 vector that shows, for each
% possible input value, the resulting output value. (The values in this
% vector are in the range [0,1], regardless of the class of the input
% image.) You can plot this data to get the transformation curve. 
%%
% Read image into the workspace.
I = imread('pout.tif');
%%
% Adjust the contrast using histogram equalization, using the |histeq|
% function. Specify the gray scale transformation return value, |T|, which
% is a vector that maps graylevels in the intensity image |I| to gray
% levels in |J|.
[J,T] = histeq(I);
%%
% Plot the transformation curve. Notice how this curve reflects the
% histograms in the previous figure, with the input values mostly between
% 0.3 and 0.6, while the output values are distributed evenly between 0 and
% 1.
figure
plot((0:255)/255,T);