5/5/11

Image Processing : Histogram Equalization using MATLAB code



% MORPHOLOGY
% histogram equalisation

filename= 'far.jpg'; % the filename to be read
im=imread(filename);
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 :


SHARE THIS POST:

9 comments:

  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.

    ReplyDelete
  2. your welcome. I have more posts on Image Processing. Join Code 2 Learn on facebook and explore more.

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

    ReplyDelete
  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 . .

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

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

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

    ReplyDelete
  6. 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

    ReplyDelete
  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.Kindly help.
    Thank you

    ReplyDelete