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

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 坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

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

相关文档推荐

Rising edge interrupt triggering multiple times on STM32 Nucleo(在STM32 Nucleo上多次触发上升沿中断)
How to use va_list correctly in a sequence of wrapper functions calls?(如何在一系列包装函数调用中正确使用 va_list?)
OpenGL Perspective Projection Clipping Polygon with Vertex Outside Frustum = Wrong texture mapping?(OpenGL透视投影裁剪多边形,顶点在视锥外=错误的纹理映射?)
How does one properly deserialize a byte array back into an object in C++?(如何正确地将字节数组反序列化回 C++ 中的对象?)
What free tiniest flash file system could you advice for embedded system?(您可以为嵌入式系统推荐什么免费的最小闪存文件系统?)
Volatile member variables vs. volatile object?(易失性成员变量与易失性对象?)