bigT=255*ones(256);
bigT(30:79,64:191)=zeros(50,128);
bigT(50:199,111:146)=zeros(150,36);
theta=(pi)/6;
bigT1=ones(256);
for x=0:255;
for y=0:255;
x1=(x*cos(theta)-y*sin(theta))+256;
y1=(x*sin(theta)+y*cos(theta));
x2=round(x1);
y2=round(y1);
bigT1(mod(x2,256)+1,mod(y2,256)+1)=bigT(x+1,y+1);
end;
end;
imshow(bigT1)
----------------------------------------------------------------------------------------------------------------------------
Skew and rotate:
newbigT=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=0:255
for y=0:255
x1=x;
y1=mod((y+1*x),256)+1;
x2=(x1*cos(theta)-y1*sin(theta))+256;
y2=(x1*sin(theta)+y1*cos(theta));
x3=round(x2);
y3=round(y2);
newbigT(mod(x3,256)+1,mod(y3,256)+1)=bigT(x+1,y+1);
end;
end;
imshow(newbigT)
No comments:
Post a Comment