⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rotate.m

📁 matlab代码
💻 M
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -