Problem:
Enlarge the color images that you scaled down in assignment 7
using a factor of by 1/f. Use the bilinear interpolation approximation.
function largeimage=growing(small,f)
rows=size(smallimage,1);
cols=size(smallimage,2);
Mp=floor(size(smallimage,1)*f);
Np=floor(size(smallimage,2)*f);
for i=1:(Mp-1);
for j=1:(Np-1);
a=i/f+1;
b=j/f+1;
r=floor(a);
s=floor(b);
if(r greater 0)&(r less rows)&(s greater 0)&(s less cols)
for k = 1:3;
largeimage(i,j,k)=[1-a+r,a-r]*double([small(r,s,k),small(r,s+1,k);small(r+1,s,k),small(r+1,s+1,k)])*[1-b+s;b-s];
end
end
end
end
endfunction
A=imread("p2.jpg");
B=growing((double(A)/255),(4));
imshow(B)
Sunday, June 22, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment