Histogram equalisation using Matlab

August 24, 2009

I have started learning the Image Processing toolbox of Matlab. My second tutorial was Histogram equalisation.

I downloaded a rice grain image shown  below: Rice grain image before equalisationNow, the following code was used:

I = imread(‘rice.png’) ¬†// The image is in the working directory.

figure,imhist(I)

The histogram of the image is shown in the figure below:

Histogram of ImageThe image was equalised using the following commands:

I2 = histeq(I);

figure, imhist(I2)

The equalised histogram is shown below:

Histogram EqualisationAn image with an improved contrast was obtained as shown in the image below:

aftereqBingo! The contrast of the image has improved!!!

Advertisements