rotate.m
来自「matlab代码」· M 代码 · 共 29 行
M
29 行
function out_image=rotate(image,theta);
rotate=[cos(theta),sin(theta);-sin(theta),cos(theta)];
[height,width]=size(image);
out_image=zeros(height,width);
center=[ceil(height/2),ceil(width/2)];
newxy=zeros(2,1);
newx=0;newy=0;
for i=1:height
for j=1:width
newxy=rotate*[(j-center);(i-center)];
newx=round(newxy(1,1))+center;newy=round(newxy(2,1))+center;
newx=newx(1,1);
newy=newy(1,1);
if newx>0 & newx <=width & newy>0 & newy<=height
out_image(i,j)=image(newy,newx);
end;
end;
end;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?