You are on page 1of 23

# Eng.

Feb,2012

## MatLab :Matrix Laboratory

LOGO
2

LOGO
3

LOGO
Images Formats
JPEG , TIFF, BMP, PNG and GIF

LOGO

## double data type:

0 and 1 to each pixel. The value 0 corresponds to black and the value
1 corresponds to white.

The uint8
which assigns an integer between 0 and 255 to represent the
brightness of a pixel. The value 0 corresponds to black and 255 to white.

LOGO

LOGO

>> I3=im2double(I);

## >> I2=rgb2gray(I);  Gray

>> I4=im2double(I2);
LOGO

Interpolation

LOGO

clear all
figure(1)
imshow(y1)

figure(2)
y=rgb2gray(y1);
imshow(y)

for i=20:180;
for j=170:280;
I(i-19,j-169)=y(i,j);
end
end
figure(3)
subimage(I)
LOGO
20

40

60

80

100

120

140

160
20 40 60 80 100

LOGO

## % Reducing the Size of I using nearest neighbor

interpolation
I128=imresize(I,0.5); imshow(I128),pause
I64=imresize(I,0.25);close,imshow(I64),pause
I32=imresize(I,0.125);close,imshow(I32),pause
I16=imresize(I,0.0625);close,imshow(I16),pause

LOGO

LOGO

I32_N=imresize(I32,8);
I64_N=imresize(I64,4);
I128_N=imresize(I128,2);

subplot(151),subimage(I),axis off,title('I')
subplot(152),subimage(I128_N ),axis off,title('I128')
subplot(153),subimage(I64_N ),axis off,title('I64')
subplot(154),subimage(I32_N ),axis off,title('I32')
subplot(155),subimage(I16_N ),axis off,title('I16')

LOGO
In neighbor interpolation the new pixels which result from zoom out the image will
take the value of its neighbor.
So the image with small size will appear as a group of rectangles of gray color, which
result from assigns of each pixels to its nearest.

LOGO
Re Add the resultant face Portion neighbor to the original Image

K=size(I32_N)
for i=20:(K(1)+19);
for j=170:(K(2)+169);
y(i,j)= I32_N(i-19,j-169);
end
end
figure(3)
imshow(y)
%%Apply for I16_N,I64_N,I32_N,I128_N

LOGO

LOGO

I128=imresize(I,0.5,'bilinear');

LOGO