对图像进行任意角度旋转clear all;I=imread(AA.jpg);II=size(I)theta=1.2;X=fix(sqrt(II(1)*II(1)+II(2)*II(2)+1);Y=X;B=zeros(X,Y,3);% x-x0=cos(theta)*(i-i0)-sin(theta)*(j-j0)% y-y0=sin(theta)*(i-i0)+cos(theta)*(j-j0)x0=fix(II(1)/2);y0=fix(II(2)/2);i0=fix(X/2);j0=fix(Y/2);for i=1:Xfor j=1:Yx=fix(x0+cos(theta)*(i-i0)-sin(theta)*(j-j0);y=fix(y0+sin(theta)*(i-i0)+cos(theta)*(j-j0);if x1 B(i,j,2)=I(x,y,2);B(i,j,3)=I(x,y,3);endendendimshow(uint8(B);imwrite(uint8(B),b.bmp,bmp);