- 1、本文档共11页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
实验一图像几何变换课件
实验一 图像几何变换;实验一: 图像几何变换;实验一: 图像几何变换;实验一: 图像几何变换;图像缩放算法流程图;实验一: 图像几何变换;实验一: 图像几何变换;function outimage=immirrli(Image,direction)
%图像镜象,水平,垂直,both
% Image - intensity image
% direction is horizontal,vertical or both.
[M,N]=size(Image);
outimage=zeros(M,N);
if nargin==1
direction=horizontal;
end
for x=1:M %compute the output image
for y=1:N
switch direction
case horizontal,
x0=x; y0=N-y+1;
case vertical,
x0=M-x+1;y0=y; %Directionality factor
case both,
x0=M-x+1; y0=N-y+1; %Directionality factor
end
outimage(x,y)=Image(x0,y0); %给新图像中的像素赋值
end
end
%show image
subplot(121),imshow(Image);title(原图像);
subplot(122),imshow(outimage,[]);title(direction);;function outimage=imtranslateli(I,deltax,deltay,zoo)
%图像平移
%Input: I the image to be translate,deltax and deltay are the number of
%pixels to be translated along x and y axies
%Output: result the image translated
[m n]=size(I);
zoom=0; %zoom 画布是否扩大的因子,默认为画布不扩大
if nargin3
zoom=zoo;
end
if zoom
outimage=zeros(m+deltax,n+deltay); %画布扩大*
else
outimage=zeros(m,n);
end
[m0 n0]=size(outimage); %处理后图像初始化
for y=1:n0
for x=1:m0
x0=x-deltax;
y0=y-deltay;
if x0=1 x0=m y0=1 y0=n
outimage(x,y)=I(x0,y0); %给新图像中的像素赋值*
end
end
end
subplot(121),imshow(I);title(原图像); %show image
subplot(122),imshow(outimage,[]);title(平移后图像);;function r=imrotateli(I,theta)
%图像旋转
%以图像中心为坐标原点
[h0 w0]=size(I);
theta=(theta*pi/180);
cosa=cos(theta);sina=sin(theta);
%图像原四个顶点坐标
srcx1=-w0*0.5;srcy1=h0*0.5;
srcx2=w0*0.5;srcy2=h0*0.5;
srcx3=-w0*0.5;srcy3=-h0*0.5;
srcx4=w0*0.5;srcy4=-h0*0.5;
%图像旋转后四个顶点坐标
dstx1=cosa*srcx1-sina*srcy1;dsty1=sina*srcx1+cosa*srcy1;
dstx2=cosa*srcx2-sina*srcy2;dsty2=sina*srcx2+cosa*srcy2;
dstx3=cosa*srcx3-sin
文档评论(0)