Tuesday, June 24, 2008

Assignment 8, question # 3

Enlarge images using factor 1/f and bilinear intearpolation approximation.
We may use the same function that we used in assignment #7:

function[B]=increase3(A,f)
A=double(A)/255
p=floor(size(A,1)*f);
q=floor(size(A,2)*f);
for i=0:p-1
for j=0:q-1
c=i/f;
d=j/f;
r=floor(c);
s=floor(d);
if(r>0)&(r<256)&(s>0)&(s<256)
for k=1:3
B(i,j,k)=[1-c+r,c-r]*[A(r,s,k),A(r,s+1,k);
A(r+1,s,k),A(r+1,s+1,k)]*[1-d+s;d-s];
end
end
end
end


A=imread('toyboy.jpg.');
B=decrease3(A,.75);
C=increase(B,4/3);
> image(255*C)
>> size(A)

ans =

160 128 3

>> size(B)

ans =

119 95 3

>> size(C)

ans =

157 125 3



















Very similar codes for 2 other pictures.







No comments: