给定来自间隔已知距离的两个相机的两个图像,如何测量到物体的距离

发布于 2024-09-19 10:05:23 字数 1539 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷清清 2024-09-26 10:05:23

我正在寻找一个开源项目或库(c++、c),它可以为我提供一种计算到图像中某个对象(像素)的距离的方法,假设我拥有有关相机的所有信息 -视野、焦距、相机之间的距离等。

根据“等”到底是什么,解决方案介于简单和不可能之间。

如果您有完全校准的相机(内在参数+相对外在参数),则计算距离就是计算两条视线并使之相交。视线直接来自所有已知参数和像素位置。将它们相交就是求解具有 4 个方程和 3 个未知数的线性最小二乘问题。

如果您只有内部相机参数(最多 5 个自由度,通常是上三角 3x3 矩阵)和相机之间的距离,则需要首先重建两个相机相对位姿的剩余 5 个自由度。这可以通过计算一组点对应关系的“基本矩阵”F 并将其除以已知的摄像机矩阵来完成,从而得到“基本矩阵”E。该矩阵可以进一步分解为旋转和叉积矩阵。这会告诉您第二个摄像头相对于第一个摄像头的定位方式。将此与相机之间的已知距离相结合,您将能够计算“您看到的”事物的度量重建。

如果您甚至不知道所有内在参数,则无法计算度量重建,而只能计算某种“投影重建”。但这并不是您真正想要的。

建议阅读:Hartley 和 Zisserman 的多视图几何

I'm looking for an open source project or library (c++, c) that can give me a method to calculate the distance to a certain object (pixel) in the image, assuming I have all the info about the cameras - The field of view, focal length, distance between cameras, etc..

Depending on what exactly "etc" is, the solution is somewhere between easy and impossible.

If you have fully calibrated cameras (intrinsic parameters + relative extrinsic parameters) computing the distance is a matter of computing and intersecting two lines of sight. The lines of sight directly follow from all the known parameters and the pixel positions. Intersecting them is a matter of solving a linear least squares problem with 4 equations and 3 unknowns.

If you only have intrinsic camera parameters (Up to five degrees of freedom, usually an upper triangular 3x3 matrix) and the distance between the cameras you need to first reconstruct the remaining 5 degrees of freedom for the relative pose of the two cameras. This can be done by computing the "fundamental matrix" F for a set of point correspondences and dividing it by the known kamera matrices so you get the "essential matrix" E. This matrix can be further factored into a rotation and a cross product matrix. This tells you how the second camera is positioned relative to the first. Combinind this with the known distance between cameras, you'll be able to compute a metric reconstruction of things "you see".

If you don't even know all the intrinsic parameters you can't compute a metric reconstruction but only some kind of "projective reconstruction". But that's not really what you want.

Suggested reading: Multiple View Geometry by Hartley and Zisserman

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文