Sunday, June 22, 2008

Assign8 Q2

Problem:
Enlarge the color images that you scaled down in assignment 7
using a factor of 1/f. Use the "nearest neighbor" approximation.



function largeimage=growing(smallimage,f)
Mp=size(smallimage,1);
Np=size(smallimage,2);
newMp=floor(size(smallimage,1)*f);
newNp=floor(size(smallimage,2)*f);
for i=0:(newMp-1)
for j=0:(newNp-1)
a=round((i/f)+1);
b=round((j/f)+1);
if(a greater 0)&(a lessMp)&(b greater 0)&(b less Np)
largeimage(i+1,j+1,:)=smallimage(a,b,:);
end
end
end
end
A=imread("p1.jpg");
B=growing((double(A)/255),(4/3));
imshow(B)

No comments: