You are on page 1of 4

7

clc; arr=[0 1 2 3 4 5 6 7]; arr=arr/7; arr=sqrt(arr); arr=arr.*7; plot(arr); grid;

0 1

Q#5: Write a code in Matlab to perform the Zooming In/Out using Nearest Neighbor Interpolation
clc; image=imread('cameraman.jpg'); [r c]=size(image); t=input('press 1 for Zoom In: \npress 2 for Zoom Out: \n'); if(t==1) i=input('enter the zoomin value: '); i=[r+i c+i]; res=imresize(image,i,'nearest'); imshow(res); elseif(t==2) i=input('enter the zoomout value: '); i=[r-i c-i]; res=imresize(image,i,'nearest'); imshow(res); end

Original image 1

ZOOM IN IMAGES

Zoomin image (a) Zoomin image (b)

Zoomin image( c)

ZOOM OUT IMAGES

Zoom out image (b) Zoom out image (a)

Zoom out image ( c)

Zoom out image (d)

Zoom out image (e)

Zoom out image (f)

You might also like