投影几何:如何将 3D 中的矩形投影转换为 2D 视图 [英] projective geometry: how do I turn a projection of a rectangle in 3D into a 2D view

查看:35
本文介绍了投影几何:如何将 3D 中的矩形投影转换为 2D 视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以问题是我有一个矩形的 3D 投影,我想把它变成 2D.也就是说,我有一张放在桌子上的纸的照片,我想将其转换为该纸的 2D 视图.所以我需要的是通过恢复所有 3D/投影转换并从顶部获得工作表的平面视图来获得未失真的 2D 图像.我碰巧找到了有关该主题的一些说明,但他们没有建议立即说明如何实现这一目标.获得有关需要完成的工作的分步说明会非常有帮助.或者,一个指向资源的链接,可将其分解为小细节.

So the problem is that I have a 3D projection of a rectangle that I want to turn into 2D. That is I have a photo of a sheet of paper laying on a table which I want to transform into a 2D view of that sheet. So what I need is to get an undistorted 2D image by reverting all the 3D/projection transformations and getting a plain view of the sheet from the top. I happened to find some directions on the subject but they don't suggest an immediate instruction on how this can be achieved. It would be really helpful to get a step-by-step instruction of what needs to be done. Or, alternatively, a link to a resource that breaks it down to little details.

推荐答案

您需要更多信息才能做到这一点.例如纸张的大小.假设您拥有它.

You need more information in order to do that. For example the size of the sheet of paper. Let's say you have it.

您需要了解的内容称为单应性".这基本上是以下情况:

What you need to learn about is called "homography". This is basically the following situation:

你有相同的平面(你的纸),你用两个不同的相机拍了一张照片(假设一个是你拥有的实际图像,另一个是你想要获得的 - 一个相机正好在这张纸的上方).

You have the same planar surface (your sheet of paper) and you take a picture of it from two different cameras (Say one is the actual image that you have and the other is the one that you want to obtain - the one with the camera exactly above the sheet of paper).

存在从一个图像的 2D 空间到另一个图像的 2D 空间(单应性)的转换,您的目标是找到它.找到后,您只需将其应用到您的图像即可获得顶视图.

There exists a transformation from 2D space of one image to 2D space of the other image (homography) and your goal is to find it. Once you find it you just apply it to your image to get the top view.

为了找到单应矩阵,您需要(至少)4 个点,您在两个图像中都知道其坐标.

In order to find the homography matrix you need (at least) 4 points, whose coordinate you know in BOTH images.

当然,这些点的一个明显选择是纸张的顶点.在您拥有的图像中,您可以手动找到它们.在目标图像中,您可以选择使工作表居中 (0,0) 的那些,知道它的尺寸.

An obvious choice for those points are the vertices of the sheet of paper of course. In the image that you have you can locate those by hand. In the target image, you can pick those such that the sheet is centered it (0,0), knowing the dimensions of it.

网上有4个点关于单应矩阵的大量信息.只是我第一次遇到的一个,所以一定有更好的资源:)

There is plenty of information about the homography matrix from 4 points online. This is just one of the first I came upon, so there must be better sources out there :)

请注意,这些计算通常在 2D 射影空间中完成,因为这是一个射影变换.

Note that most often these computation are done in the 2D projective space, as this is a projective transformation.

这篇关于投影几何:如何将 3D 中的矩形投影转换为 2D 视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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