从图像坐标获取对象的世界坐标

时间:2022-04-16 16:37:51

I have been following this documentation to use OpenCV. In the formula below, I have successfully calculated both the intrinsic as well as the extrinsic matrices(I have made use of the solvePnP() procedure to obtain these matrices). Since, the object is lying on the ground I have substituted Z = 0. Then, I just removed the third column of the extrinsic matrix and multiplied it with intrinsic matrix to obtain a 3X3 projection matrix. I took it's inverse, and multiplied it by image coordinates i.e. su,sv and s.
从图像坐标获取对象的世界坐标

我一直在关注此文档以使用OpenCV。在下面的公式中,我已经成功地计算了内部矩阵和外部矩阵(我已经使用solvePnP()过程来获得这些矩阵)。因为,物体躺在地上,我已经取代了Z = 0.然后,我只是移除了外在矩阵的第三列并将其与内部矩阵相乘以获得3X3投影矩阵。我把它反过来,然后乘以图像坐标,即su,sv和s。

However, all points in the world coordinates seem to be off by 1 mm or lesser, and hence I am getting not so accurate co-ordinates. Does anyone know where I might be going wrong?

然而,世界坐标中的所有点似乎都偏离了1毫米或更小,因此我的坐标不太准确。有谁知道我可能会出错?

Thanks

1 个解决方案

#1


0  

The camera calibration will probably always somewhat inaccurate, because for more than 2 calibration images instead of getting one true solution to equation system acquired from calibration images, You get the solution with the smallest error.

相机校准可能总是有些不准确,因为对于超过2个校准图像而不是从校准图像获得方程系统的真正解决方案,您将得到具有最小误差的解决方案。

The same goes to cv::solvePnP() . You use one of three methods of optimising the many possible solutions for given equation system.

cv :: solvePnP()也是如此。您可以使用三种方法之一来优化给定方程式系统的许多可能解决方案。

I do not understand how did You get the intrinsic and extrinsic matrices from cv::solvePnP() , which is used to calculate the rotation and translation of the object in camera coordinate system.

我不明白你是如何从cv :: solvePnP()获得内在和外在矩阵的,它用于计算相机坐标系中物体的旋转和平移。

What You can do:

你可以做什么:

  • Try to get better intrinsic parameters
  • 尝试获得更好的内在参数

  • Try other methods for solvePnP like EPNP or check the RANSAC version
  • 尝试使用其他方法解决像EPNP这样的solvePnP或检查RANSAC版本

#1


0  

The camera calibration will probably always somewhat inaccurate, because for more than 2 calibration images instead of getting one true solution to equation system acquired from calibration images, You get the solution with the smallest error.

相机校准可能总是有些不准确,因为对于超过2个校准图像而不是从校准图像获得方程系统的真正解决方案,您将得到具有最小误差的解决方案。

The same goes to cv::solvePnP() . You use one of three methods of optimising the many possible solutions for given equation system.

cv :: solvePnP()也是如此。您可以使用三种方法之一来优化给定方程式系统的许多可能解决方案。

I do not understand how did You get the intrinsic and extrinsic matrices from cv::solvePnP() , which is used to calculate the rotation and translation of the object in camera coordinate system.

我不明白你是如何从cv :: solvePnP()获得内在和外在矩阵的,它用于计算相机坐标系中物体的旋转和平移。

What You can do:

你可以做什么:

  • Try to get better intrinsic parameters
  • 尝试获得更好的内在参数

  • Try other methods for solvePnP like EPNP or check the RANSAC version
  • 尝试使用其他方法解决像EPNP这样的solvePnP或检查RANSAC版本