9
Digital Image Processing Project # 2 Dr.Nathir Rawashdeh Name : Majd Ali Khaleel ID # :2008102003 4 . Dec.2010

Image Processing using Matlab ( using a built in Matlab function(Histogram equalization )

Embed Size (px)

DESCRIPTION

Image Processing using Matlab ( using a built in Matlab function(Histogram equalization ).

Citation preview

Page 1: Image Processing using Matlab ( using a built in Matlab function(Histogram equalization )

Digital Image Processing

Project # 2

Dr.Nathir Rawashdeh

Name : Majd Ali Khaleel

ID # :2008102003

4.Dec.2010

Page 2: Image Processing using Matlab ( using a built in Matlab function(Histogram equalization )

1-In this part I have used a built in Matlab function(Histogram equalization ).

Code:

i=rgb2gray(imread('majd.jpg'));

Imshow(i); j=histeq(i) ;

Imshow(j); imhist(i) ;imhist(j);

Figure(1-before) figure(2-after)

*firstly I have loaded an image then I converted it to gray image ,after that I have showed it (figure # 1);

*in the second step I have used a built in function (histeq() )which made a histogram equalization for

Page 3: Image Processing using Matlab ( using a built in Matlab function(Histogram equalization )

loaded image (i);after that I have showed the result(figure # 2).

figure(3-before) figure(4-after)

*we note the image before histeq was a low contrast (figure 3) & after equalization the values of intensity distributed (figure 4)& the image became lighter.

--------------------------------------------------------------------

2 -In this part I have used a built in MATLAB function ( Gamma Correction).

Code :

i=rgb2gray(imread('majd.jpg')); imshow(i);

z=imadjust(i,[],[],0.3); figure(2) ; imshow(z);

x=imadjust(i,[],[],2); figure(3) ; imshow(x);

Note : empty matrices refer to the data ranges of inputs and outputs

Page 4: Image Processing using Matlab ( using a built in Matlab function(Histogram equalization )

Figure(1-original) figure(2-gamma=0.3) figure(3-gam=3)

*firstly I have loaded an image then I used (imadjust) function to make the image lighter or darker (I used gamma correction) ,figure 1 represent the original image & figure 2 represent the image after correction by gamma = 0.3 ,we note the image became lighter, figure 3 ,represent the image after correction by gamma = 3 ,we note here the image became darker.

Note : if gamma =1 the image we stay as original image as ,& if gamma <1 the image become lighter & if gamma

>1 the image become darker.

3 -In this part I have written a MATLAB script that performs spatial filtering.

My filter mask is : [1 0 -1;1 0 -1;1 0 -1];

Page 5: Image Processing using Matlab ( using a built in Matlab function(Histogram equalization )

Code:

Page 6: Image Processing using Matlab ( using a built in Matlab function(Histogram equalization )

Result:

( Before( )after)

The function of this filter:

It make image lighter than the original image.

It does like gamma correction but in inverse ,when we increase or decrease the values of filter

For ex: put 3 instead 1 & -3 instead -1 ,the image will become lighter and lighter (but in gamma correction the image becomes darker)

And if we put 0.5 instead 1 & -0.5 instead -1 ,the image will become darker and darker (but in gamma correction the image becomes lighter )