如果已知外在和内在参数,则从 2D 图像像素获取 3D 坐标

Get 3D coordinates from 2D image pixel if extrinsic and intrinsic parameters are known(如果已知外在和内在参数,则从 2D 图像像素获取 3D 坐标)
本文介绍了如果已知外在和内在参数,则从 2D 图像像素获取 3D 坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在使用 tsai algo 进行相机校准.我得到了内在和外在矩阵,但如何从该信息重建 3D 坐标?

I am doing camera calibration from tsai algo. I got intrensic and extrinsic matrix, but how can I reconstruct the 3D coordinates from that inormation?

1) 我可以使用高斯消元法找到 X、Y、Z、W,然后点将是 X/W 、 Y/W 、 Z/W 作为齐次系统.

1) I can use Gaussian Elimination for find X,Y,Z,W and then points will be X/W , Y/W , Z/W as homogeneous system.

2) 我可以使用OpenCV 文档方法:

2) I can use the OpenCV documentation approach:

据我所知 u, v, R , t ,我可以计算 X,Y,Z.

as I know u, v, R , t , I can compute X,Y,Z.

然而,这两种方法最终都会得到不正确的不同结果.

However both methods end up in different results that are not correct.

我做错了什么?

推荐答案

如果您有外部参数,那么您就拥有了一切.这意味着您可以从外在变量(也称为 CameraPose)获得 Homography.Pose是一个3x4的矩阵,homography是一个3x3的矩阵,H定义为

If you got extrinsic parameters then you got everything. That means that you can have Homography from the extrinsics (also called CameraPose). Pose is a 3x4 matrix, homography is a 3x3 matrix, H defined as

                   H = K*[r1, r2, t],       //eqn 8.1, Hartley and Zisserman

其中K是相机内在矩阵,r1r2是旋转矩阵的前两列,R;t 是平移向量.

with K being the camera intrinsic matrix, r1 and r2 being the first two columns of the rotation matrix, R; t is the translation vector.

然后将所有内容除以 t3 归一化.

Then normalize dividing everything by t3.

r3 列会发生什么,我们不使用它吗?不,因为它是多余的,因为它是姿势的前 2 列的叉积.

What happens to column r3, don't we use it? No, because it is redundant as it is the cross-product of the 2 first columns of pose.

既然你有了单应性,就投影点.你的 2d 点是 x,y.将它们添加为 z=1,因此它们现在是 3d.按如下方式对其进行投影:

Now that you have homography, project the points. Your 2d points are x,y. Add them a z=1, so they are now 3d. Project them as follows:

        p          = [x y 1];
        projection = H * p;                   //project
        projnorm   = projection / p(z);      //normalize

希望这会有所帮助.

这篇关于如果已知外在和内在参数,则从 2D 图像像素获取 3D 坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Bring window to front -gt; raise(),show(),activateWindow() don’t work(把窗户放在前面 -raise(),show(),activateWindow() 不起作用)
How to get a list video capture devices NAMES (web cameras) using Qt (crossplatform)? (C++)(如何使用 Qt(跨平台)获取列表视频捕获设备名称(网络摄像机)?(C++))
How to compile Qt as static(如何将 Qt 编译为静态)
C++ over Qt : Controlling transparency of Labels and Buttons(C++ over Qt:控制标签和按钮的透明度)
How to know when a new USB storage device is connected in Qt?(Qt如何知道新的USB存储设备何时连接?)
What is an event loop in Qt?(Qt 中的事件循环是什么?)