大家帮忙看一看哪里出了问题呢
谁能帮我看看这个对图像刚性变换的程序哪里出了问题,为什么只能旋转,不能平移呢?
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
|