Tuesday, June 10, 2008

Assignment 8 Question 3

Enlarge the color images that you scaled down in assignment 7 using a factor of
1/f. Use the bilinear interpolation approximation.

function [ largeimage ] = enlargebi( picture, f )
picture=double(picture);
Mp = size(picture,1);
Np = size(picture,2);

for i = 1:(f*Mp);
for j = 1:(f*Np);
a=i/f;
b=j/f;
r=floor(a)+2;
s=floor(b)+2;
if s>0 && s<=size(picture,2) && r>0 && r<=size(picture,1)
for k=1:3;
largeimage(i,j,k)=[1-a+(r-2) a-(r-2)]*[picture(r-1,s-1,k) picture(r-1,s,k); picture(r,s-1,k) picture(r,s,k)]*[1-b+(s-2); b-(s-2)];
end;
end;
end;

end;

>> B = shrink(bluelines,0.1);
>> imshow(enlargebi(B,10))
>> B = shrink(bluelines,0.25);
>> imshow(enlargebi(B,4))
>> B = shrink(bluelines,0.75);
>> imshow(enlargebi(B,4/3))






No comments: