将2D图像点转换为3D世界点 [英] Converting a 2D image point to a 3D world point

查看:702
本文介绍了将2D图像点转换为3D世界点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在一般情况下,由于深度信息从3d到2d丢失,所以无法进行此转换。



但是,我有一个固定的相机和我知道它的相机矩阵。我还有一个已知尺寸的平面校准图案 - 假设在世界坐标系中有角(0,0,0)(2,0,0)(2,1,0)(0) ,1,0)。使用opencv我可以估计模式的姿态,给出将对象上的点投影到图像中的像素所需的平移和旋转矩阵。

现在:这个3d图像投影很容易,但是另一种方式呢?如果我选择图像中的像素,我知道是校准图案的一部分,我如何获得相应的3d点?



I可以在校准图案上迭代地选择一些随机的3d点,投影到2d,并且基于误差细化3d点。



由于这个未知点具有类似(x,y,0)的世界坐标,因为它必须位于z = 0平面上 - 似乎应该有一些转换,我可以应用,而不是做迭代废话。

解决方案

是的,你可以能够。如果有一个将3d世界中的点映射到图像平面的变换矩阵,则可以使用该变换矩阵的逆,将图像平面点映射到3d世界点。如果你已经知道z = 0的3d世界点,这将导致一个解决方案的点。将不需要迭代地选择一些随机的3d点。我有一个类似的问题,我有一个相机安装在车辆上已知的位置和相机校准矩阵。我需要知道在摄像机的图像位置捕获的车道标记的真实世界位置。


I know that in the general case, making this conversion is impossible since depth information is lost going from 3d to 2d.

However, I have a fixed camera and I know its camera matrix. I also have a planar calibration pattern of known dimensions - let's say that in world coordinates it has corners (0,0,0) (2,0,0) (2,1,0) (0,1,0). Using opencv I can estimate the pattern's pose, giving the translation and rotation matrices needed to project a point on the object to a pixel in the image.

Now: this 3d to image projection is easy, but how about the other way? If I pick a pixel in the image that I know is part of the calibration pattern, how can I get the corresponding 3d point?

I could iteratively choose some random 3d point on the calibration pattern, project to 2d, and refine the 3d point based on the error. But this seems pretty horrible.

Given that this unknown point has world coordinates something like (x,y,0) -- since it must lie on the z=0 plane -- it seems like there should be some transformation that I can apply, instead of doing the iterative nonsense. My maths isn't very good though - can someone work out this transformation and explain how you derive it?

解决方案

Yes, you can. If you have a transformation matrix that maps a point in the 3d world to the image plane, you can just use the inverse of this transformation matrix to map a image plane point to the 3d world point. If you already know that z = 0 for the 3d world point, this will result in one solution for the point. There will be no need to iteratively choose some random 3d point. I had a similar problem where I had a camera mounted on a vehicle with a known position and camera calibration matrix. I needed to know the real world location of a lane marking captured on the image place of the camera.

这篇关于将2D图像点转换为3D世界点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆