从已知的基本矩阵画一条对极线

时间:2019-10-08 14:23:14

标签: c++ geometry computer-vision stereo-3d

我已经设法从图像1到图像2绘制了对极线。 现在,我的目标是使用相同的基本矩阵从图像2到图像1绘制对极线。

所以我尝试了相同的逻辑,但是对极线不对应于单击的点。

  

从图像1到图像2的极线:有效

Point m1(x, y);

Data* D = (Data*)p;
circle(D->I1, m1, 2, Scalar(0, 255, 0), 2);
imshow("I1", D->I1);

Vec3d m1p(m1.x, m1.y, 1);
// Epipolar line equation 
Vec3d l = D->F*m1p;

// 1 - compute two points on the epipolar line and draw it
Point m2a(0,-l(2)/l(1)),m2b(D->I2.width(),-(l(0)*D->I2.width()+l(2))/l(1));
line(D->I2,m2a,m2b,Scalar(0,255,0),1);

imshow("I2", D->I2);
  

从图像2到图像1的极线:不起作用

Point m2(x, y);

Data* D = (Data*)p;
circle(D->I2, m2, 2, Scalar(0, 255, 0), 2);
imshow("I2", D->I2);

Vec3d m2p(m2.x, m2.y, 1);
// Epipolar line equation 
Vec3d l = D->F*m1p;

// 1 - compute two points on the epipolar line and draw it
Point m2a(0,-l(2)/l(1)),m2b(D->I2.width(),-(l(0)*D->I2.width()+l(2))/l(1));
line(D->I1,m2a,m2b,Scalar(0,255,0),1);

imshow("I1", D->I1);

Here is what the output looks like

我理解错了什么?

0 个答案:

没有答案