如何计算立体视觉的基本矩阵 [英] How to calculate the fundamental matrix for stereo vision

查看:274
本文介绍了如何计算立体视觉的基本矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一些代码来计算基本矩阵来确定立体图像之间的关系。我开始与Hartley和Zisserman的书,大多数人推荐,但它没有任何实际的例子,它的示例代码是在MATLAB我没有。然后,我切换到 3D计算机视觉技术和算法介绍< a>这是更实际和有实际例子。我使用Python和numpy实现了推荐的8点算法,但我无法验证它的有效性。



我使用第48页上列出的数据集(使用上面的链接查看Google图书摘录)。当我规范点,我得到与那本书相同的结果。但是,当我使用numpy的SVD函数来计算基本矩阵时,我得到F的以下值:

  [[ -  0.01851684 -0.21631176 -0.67036356] 
[0.2605251 -0.01023853 0.14234079]
[0.63748775 -0.09404508 -0.00220713]]

此矩阵满足方程 p_R ^ * F * p_L = 0 ,因此看起来是正确的。然而,它与本书中计算的矩阵非常不同。我试着用OpenCV的cv.FindFundamentalMat()检查答案,我得到第三个答案:

  [[22.98129082 271.46453857 853.74273682 ] 
[-334.1673584 -4.84123087 -175.99523926]
[-809.88891602 125.99833679 1.]]


$ b我不是如何计算那些其他两个矩阵,但我找不到任何基本矩阵计算的例子在网上验证我的8点算法的实现。事实上,我的实现返回一个满足方程的值给了我信心,但我担心我做了一些愚蠢,这就是为什么我不能匹配的结果在本书或OpenCV。

$ b $注意,Fundamental矩阵定义为一个常数因子(你可以通过检查对极约束很容易地验证)。尝试将OpenCV矩阵乘以-8.0574e-04,你会看到两个矩阵在结尾是相似的: - )



因此,你的结果可能是精细。结果之间的微小差异可能是由于OpenCV采用与8点算法不同(可能更稳健)的方法。


I'm trying to write some code that will calculate the fundamental matrix to determine the relationship between stereo images. I started with the Hartley and Zisserman book that most people recommend, but it didn't have any practical examples and the sample code for it was in MATLAB which I don't have. I then switched to An introduction to 3D Computer Vision Techniques and Algorithms which is more practical and has actual examples in it. I implemented the recommended 8-point algorithm using Python and numpy, but I'm having trouble verifying the validity of it.

I'm using the dataset listed on page 48 (use that link above to see a Google Books excerpt) of that book. When I normalize the points, I get the same results as that book. However, when I use numpy's SVD function to calculate the fundamental matrix, I get the following value for F:

[[-0.01851684 -0.21631176 -0.67036356]
 [ 0.2605251  -0.01023853  0.14234079]
 [ 0.63748775 -0.09404508 -0.00220713]]

This matrix satisfies the equation p_R^ * F * p_L = 0 so it seems correct. However, it is very different from the matrix calculated in the book. I tried to double check the answer using OpenCV's cv.FindFundamentalMat() and I got a third answer:

[[  22.98129082  271.46453857  853.74273682]
 [-334.1673584    -4.84123087 -175.99523926]
 [-809.88891602  125.99833679    1.        ]]

I'm not how those other two matrices are calculated, but I can't find any examples of fundamental matrix calculation on the web to verify my implementation of the 8-point algorithm. The fact that my implementation returns a value that satisfies the equation gives me confidence, but I'm worried that I did something silly which is why I can't match the results in the book or by OpenCV.

解决方案

Note that the Fundamental matrix is defined up to a constant factor (you can verify that quite easily, by checking the epipolar constraint). Try multiplying the OpenCV matrix with -8.0574e-04 and you'll see that the two matrices are quite similar in the end :-)

Thus, your result is probably fine. The slight difference between the results is probably due to the fact that OpenCV employs a different (probably more robust) approach than the 8-point algorithm.

这篇关于如何计算立体视觉的基本矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆