我试图使用3D变换矩阵转换图像,并假设我的相机是正交的.
我使用平面诱导的单应公式H = Rt*n'/ d(d = Inf so H = R)定义我的单应性,如Hartley和Zisserman第13章中给出的那样.
令我感到困惑的是,当我使用相当适度的旋转时,图像似乎比我预期的扭曲得多(我确信我不会混淆弧度和度数).
这可能会出错?
我附上了我的代码和示例输出.
n = [0;0;-1];
d = Inf;
im = imread('cameraman.tif');
rotations = [0 0.01 0.1 1 10];
for ind = 1:length(rotations)
theta = rotations(ind)*pi/180;
R = [ 1 0 0 ;
0 cos(theta) -sin(theta);
0 sin(theta) cos(theta)];
t = [0;0;0];
H = R-t*n'/d;
tform = maketform('projective',H');
imT = imtransform(im,tform);
subplot(1,5,ind) ;
imshow(imT)
title(['Rot=' num2str(rotations(ind)) 'deg']);
axis square
end
Run Code Online (Sandbox Code Playgroud)