Wednesday, June 4, 2008

assignment #6 Q1


Q(1)

newmatrix=128*ones(256);

bigT=255*ones(256);

bigT(30:79,64:191)=zeros(50,128);

bigT(50:199,111:146)=zeros(150,36);

theta=(pi)/6;

for x=1:256;

for y=1:256;

u=x*cos(theta) - y*sin(theta);

v=x*sin(theta) + y*cos(theta);

up=mod(u,256) + 1;

vp=mod(v,256) + 1;

a=up;

b=mod(vp-1*up,256)+1;

r=floor(a);

s=floor(b);

if (r>0) & (r<256)>0) & (s<256);

mata=[1-a+r, a-r];

matb=[bigT(r,s), bigT(r,s+1); bigT((r+1),s), bigT((r+1),(s+1))];

matc=[1-b+s;b-s];

newmatrix(x,y)=mata*matb*matc;

end;

end;

end;

imshow(newmatrix)

1 comment:

Mike Zabrocki said...

why is the T partially cut off? Can you explain why what you see is correct since it seems to me that the whole T should be there?