Matlab Tutorial : Digital Image Processing 5 - Histogram Equalization
bogotobogo.com site search:
Histogram of the original image
Here is the input image which I got from wiki - Histogram equalization:
It's histogram looks like this:
img = imread('Hawkes_Bay_NZ.jpg'); imhist(img);
bogotobogo.com site search:
Histogram Equalization
The Histogram Equalization algorithm enhances the contrast of images by transforming the values in an intensity image so that the histogram of the output image is approximately flat. See the picture below.
Picture source: wiki
img = imread('Hawkes_Bay_NZ.jpg'); figure, img_eq = histeq(img); imshow(img_eq);
The histogram after the histogram equalization:
img = imread('Hawkes_Bay_NZ.jpg'); imhist(histeq(img));
Enhancing contrast using imadjust()
In this section, we'll use imadjust() and get similar effect of doing histogram equalization operation.
img = imread('Hawkes_Bay_NZ.jpg'); img_adj = imadjust(img, [0.4,0.86],[0.0,1.0]); imshow(img_adj);
img = imread('Hawkes_Bay_NZ.jpg'); img_adj = imadjust(img, [0.4,0.86],[0.0,1.0]); figure; hold on; imhist(img); imhist(img_adj); hold off;
Ph.D. / Golden Gate Ave, San Francisco / Seoul National Univ / Carnegie Mellon / UC Berkeley / DevOps / Deep Learning / Visualization