Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2009-02-11
年龄: 41
帖子: 7
声望力: 0 ![]() |
![]()
谁能帮我看看这个对图像刚性变换的程序哪里出了问题,为什么只能旋转,不能平移呢?
function image_transform f=imread('E:\photos\128128.bmp'); [m,n]=size(f); fc=[m/2,n/2,1] theta=pi/18; T=[cos(theta),sin(theta),0; -sin(theta),cos(theta),0 10,10,1]; ii=0; for i=1:m ii=ii+1; jj=0; for j=1:n jj=jj+1; pf=[i,j,1]; pr=T*(pf-fc)'+fc'; if pr(1)>=m||pr(1)<=1||pr(2)<=1||pr(2)>=n g(ii,jj)=0 ; else g(ii,jj) = BilinearInterplate(f,pr); end end end |
![]() |
![]() |