This method usually increases the global contrast of images, especially when the usable data of the image is represented by close contrast values. Through this adjustment, the intensities can be better distributed on the histogram. This allows for areas of lower local contrast to gain a higher contrast. Histogram equalization accomplishes this by effectively spreading out the most frequent intensity values. It has the following form :
r and s
|are the input and output pixels of the image|
|is the different values that can be the pixels|
rkmax and rkmin
|and are the maximum and minimum gray values of the input image.|
The method is useful in images with backgrounds and foregrounds that are both bright or both dark. In particular, the method can lead to better detail in photographs that are over or under-exposed. A key advantage of the method is that it is a fairly straightforward technique and an invertible operator. So in theory, if the histogram equalization function is known, then the original histogram can be recovered. The calculation is not computationally intensive. A disadvantage of the method is that it is indiscriminate. It may increase the contrast of background noise, while decreasing the usable signal.
input_image_process = imread('newMountain.jpg'); input_image_process = rgb2gray(input_image_process); output_image_process=histeq(input_image_process); % Histogram equalization function output_image=im2uint8(mat2gray(output_image_process)); subplot(2,2,1),imshow(input_image_process),title('Input image') subplot(2,2,2),imhist(input_image_process),title('Input image histogram') subplot(2,2,3),imshow(output_image),title('Output image') subplot(2,2,4),imhist(output_image),title('Output image histogram')