简体   繁体   English

如何应用基本矩阵将 3D 点从相机 1 的世界坐标转换为相机 2 的世界坐标

[英]How to apply the essential matrix to transform a 3D point from camera 1's world coordinate to camera 2's world coordinates

Using OpenCV's cv2.stereoCalibrate I have calibrated a pair of cameras, one of them being a time-of-flight camera.使用 OpenCV 的 cv2.stereoCalibrate 我校准了一对相机,其中一个是飞行时间相机。 So, I have the intrinsic calibration parameters and the essential / fundamental matrix.所以,我有内在校准参数和基本/基本矩阵。

Now I would like to project a point from the ToF camera to the 2D camera.现在我想将一个点从 ToF 相机投影到 2D 相机。

To convert image to world coordinates in the ToF camera, I did:为了在 ToF 相机中将图像转换为世界坐标,我做了:

p = [(15, 15, 1)]
z = depth[p[0][0], p[0][1]]  # measured ToF depth for this single point

# from ToF image coordinates (including ToF depth!) to ToF world coordinates
invR_x_invM_x_uv1 = R_inv * cameraMatrix_inv_3 * p[0]
invR_x_tvec = R_inv * T
wcPoint = (z + invR_x_tvec[2]) / invR_x_invM_x_uv1[2] * invR_x_invM_x_uv1 - invR_x_tvec
wcPoint = wcPoint[:, -1]

So I have the point in world coordinates.所以我有世界坐标的观点。

What I do not get, is (1) how to transform this point to the world coordinate system of the second camera, and then (2) how to project this point to image coordinates of the second camera.我不明白的是(1)如何将此点转换为第二台相机的世界坐标系,然后(2)如何将此点投影到第二台相机的图像坐标。 Can anybody point me to a OpenCV function in particular for (1)?有人能指出我的 OpenCV 函数,特别是 (1) 吗?

First, you should get into linear algebra.首先,你应该进入线性代数。 You can't multiply matrices elementwise.您不能按元素相乘矩阵。 You have to use the dot product.你必须使用点积。 The dot product of two matrices A and B is either written as A@B or A.dot(B) in Python.两个矩阵 A 和 B 的点积在 Python 中要么写成A@B要么写成A.dot(B)

If you have a stereo calibration and two fixed cameras, you also should have the extrinsic parameters of these cameras.如果你有一个立体标定和两个固定相机,你还应该有这些相机的外在参数。 The translation and rotation between these cameras and the world coordinate system (there is only one), which could be located at the position of one of the mentioned cameras, enables you to transform your 3D data to obtain the coordinates in the chosen coordinate system.这些相机与世界坐标系(只有一个)之间的平移和旋转(可能位于上述相机之一的位置)使您能够转换 3D 数据以获得所选坐标系中的坐标。 I seriously suggest that you read the basics about camera projection in Hartley/Zisserman, Multiple View Geometry, freely available online.我郑重建议您阅读 Hartley/Zisserman 中有关相机投影的基础知识,Multiple View Geometry,可在线免费获取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将3D世界坐标转换为3D相机坐标 - How convert 3d world coordinates to 3d camera coordinates 如何将坐标系从世界转换为相机(3D 到 2D 转换)? - How can I convert a coordinate system from world to camera (3D to 2D conversion)? 我如何将相机坐标转换为世界坐标使用 opencv - how do i transform camera coordinate to world coordinate use opencv 如何将世界坐标转换为相机坐标 - How to convert from world coordinates to camera coordinates Pybullet中的旋转矩阵是将世界坐标转换为相机还是将相机转换为世界? - Is the rotation matrix in Pybullet converting world coordinates into camera or camera to world? OpenCV使用固定的相机位置将2D像素坐标映射到3D世界坐标 - Opencv map 2D pixel coordinates to 3D world coordinates using fixed camera position 如何从深度相机获取世界系统中的深度坐标 - How to get the depth coordinate in the world system from the depth camera OpenCV:将点云转换为最左侧相机的坐标系 - OpenCV: transform point clouds to leftmost camera's coordinate system 将图像中的二维点(带透视)转换为 3D 世界坐标 - Convert 2D point in image(with perspective) to 3D world coordinate 计算3D世界点 - Calculating 3D world point
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM