Image Processing : Histogram Equalization using MATLAB code

% histogram equalisation

filename= 'far.jpg'; % the filename to be read
im=imresize(im,[256,256]);
im=rgb2gray(im);
figure(1);
subplot(1,2,1);
imshow(im);

subplot(1,2,2);
Imagesc(im);  % display
axis('square');
colormap('gray');
imhist(im);
im_histeq=histeq(im);
figure(2);
subplot(1,2,1);
imshow(im_histeq);  % display
%axis('square');
colormap('gray');

subplot(1,2,2);
imhist(im_histeq);

Original Image and Histogram :

Equalized Image and Equalized Histogram :

1. Thank you. It is wonderful working code. I leaned lot form it.
It would be better if you can demonstrate other image processing techniques.

http://www.code2learn.com/search/label/image%20processing

3. sir . . Good evening sir :) i am from india in tamilnadu :) now i am studying BE /ECE final year. If i am gonna do main project sir:) if am selected digital image processing domain .but i don't having sufficient knowledge regarding it .then recently seen your post sir it wap really impressed sir. Shall you please help for me sir. Shall you suggest any one good DIP regarding project with matlab coding sir. -My email id is skysathiya@gmail.com. . Pls sir don't ignore my request . .

1. can u pls mail me that code to me also

4. please sir enhancement ka pura code post kar dijiye mai bahut pareshaan hu

5. hiiiiiii sir i m from bhu

6. maine aapka purana histogram equalization ka code download karke kaam kiya tha but abhi code nahi hai mere pas ..............please kindly do the needful

7. Sir, what I am trying to do is to use Histogram based segmentation to detect boundaries from a cartosat DEM.I am having an image in .tif format.I am trying to find matlab code for this purpose.Looking for help.
Thank you

8. Sir, what I am trying to do is to use Histogram based segmentation to detect boundaries from a cartosat DEM.I am having an image in .tif format.I am trying to find matlab code for this purpose.Kindly help.
Thank you