【发布时间】:2012-10-17 15:44:54
【问题描述】:
我有一个与projective transform 相关的问题。假设现在我们知道图像中有一个线函数ax+by+c=0,图像会经历一个投影畸变,该畸变可以表示为一个射影变换矩阵:
那么在进行了投影变换后,我怎么知道新扭曲图像中的线函数呢?谢谢!
** 编辑 ** 根据建议,我找到了答案。在这里,我贴出MATLAB代码来说明一下:
close all;
% Step 1: show the images as well as lines on it
imshow(img);
line = hor_vt{1}.line(1).line; a = line(1); b=line(2); c=line(3);
[row,col] = size(img);
x_range = 1:col;
y_range = -(a*x_range+c)/b;
hold on; plot(x_range,y_range,'r*');
line = hor_vt{1}.line(2).line; a = line(1); b=line(2); c=line(3);
y_range = -(a*x_range+c)/b;
hold on; plot(x_range,y_range,'y*');
% Step 2: show the output distorted image that goes through projective
% distortion.
ma_imshow(output);
[row,col] = size(output);
x_range = 1:col;
line = hor_vt{1}.line(1).line;
line = reverse_tform.tdata.Tinv*line(:); % VERY IMPORT
a = line(1); b=line(2); c=line(3);
y_range = -(a*x_range+c)/b;
hold on; plot(x_range,y_range,'r*');
disp('angle');
disp( atan(-a/b)/pi*180);
line = hor_vt{1}.line(2).line;
line = reverse_tform.tdata.Tinv*line(:); % VERY IMPORT
a = line(1); b=line(2); c=line(3);
y_range = -(a*x_range+c)/b;
hold on; plot(x_range,y_range,'y*');
disp('angle');
disp( atan(-a/b)/pi*180);
上面有两行的原始图像:
经过投影畸变后,带有线条的输出图像变为:
【问题讨论】:
-
也许在这里问这个更好math.stackexchange.com
标签: image-processing geometry computer-vision