Calculate the cumulative histogram
im = imread('shuttle.tif');
imh = histogram_image(im);
im_counts = imhist(im);
im_cum = cumsum(im_counts);
im_cum = im_cum/im_cum(256);
plot(x,im_cum);
xlabel('gray level');
ylabel('frequency');
Suppose the desired histogram were quadratic:
x =linspace(0,1,256); h = 1 - 4*(x-0.5).^2; plot(x,h)
Calculate the cumulative histogram
ch = cumsum(h);
ch = ch/ch(256);
plot(x,ch);
xlabel('gray level');
ylabel('frequency');
Maintained by John Loomis, last updated 4 Feb 2001