This method usually increases the global contrast of many 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 without affecting the global contrast. Histogram equalization accomplishes this by effectively spreading out the most frequent intensity values.The method is useful in images with backgrounds and foregrounds that are both bright or both dark. A disadvantage of the method is that it is indiscriminate. It may increase the contrast of background noise, while decreasing the usable signal.Histogram equalization can also be used on color images by applying the same method separately to the Red, Green and Blue components of the RGB color values of the image.
GUI of the program;


The original image is extremely grey; it lacks detail since the range of colours seems limited to mid grey-levels. We can verify this by looking at the image’s histogram. We can see the majority of the grey levels in the image are bunched between about 100 and 210.
Equalized image seems more clear than the original image, details in the cars and the floors and walls are a lot sharper. The equalized histogram looks like the original histogram, although it has been “stretched” across the entire spectrum.
Double Equalized Image


Matlab Codes;
*********************************************************************************************************
Histogram equalization function
*********************************************************************************************************
function [equalized, hist_eq] = equalize_hist(original)
hist_original=zeros(1,256);
[r,c]=size(original);
% find histogram of the image
for i=1:r
for j=1:c
hist_original(original(i,j)+1)=hist_original(original(i,j)+1)+1;
end;
end;
% create running sum of the histogram values
run_sum=zeros(1,256);
run_sum(1)=hist_original(1);
for i=1:255
run_sum(i+1)=run_sum(i)+hist_original(i+1);
end;
% normalize by dividing by total number of pixels
norm_run_sum=run_sum/run_sum(256);
%multiply these values by the maximum gray-level values.
hist_eq=round(norm_run_sum*256);
for i=1:r
for j=1:c
equalized(i,j)=uint8(hist_eq(original(i,j)+1));
end;
end;
*********************************************************************************************************
For GUI and the other parts of the code please contact with me.