在这种情况下有没有确定 3d 位置的算法? (下图)
所以首先我有这样的图像(当然我有二维的所有点坐标,这样我就可以重新生成线并检查它们相互交叉的位置)
(来源:narod.ru)
但是,嘿,我还有另一个相同线条的图像(我知道它们是相同的)和我的点的新坐标,如下图所示
(来源:narod.ru)
所以...现在有了第一个图像上的点(坐标),如何确定第二个图像上的平面旋转和 Z 深度(假设第一个图像的中心位于点 (0,0,0) 且没有旋转)?
So first of all I have such image (and ofcourse I have all points coordinates in 2d so I can regenerate lines and check where they cross each other)
(source: narod.ru)
But hey, I have another Image of same lines (I know thay are same) and new coords of my points like on this image
(source: narod.ru)
So... now Having points (coords) on first image, How can I determin plane rotation and Z depth on second image (asuming first one's center was in point (0,0,0) with no rotation)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您试图找到的称为投影矩阵。确定精确的逆投影通常需要您在源向量和目标向量中牢固地建立坐标,而上面的图像不会为您提供这些坐标。不过,您可以使用像素位置进行近似。
此帖子将为您提供基本的演练您需要使用的技术。
What you're trying to find is called a projection matrix. Determining precise inverse projection usually requires that you have firmly established coordinates in both source and destination vectors, which the images above aren't going to give you. You can approximate using pixel positions, however.
This thread will give you a basic walkthrough of the techniques you need to use.
我先说一下:这个问题很难。丹·斯托里的相关问题尚未得到解答是有原因的。让我们为那些想尝试一下的人提供一个解释。不过,我希望我对这件事的难度的判断是错误的。
我假设您知道 2D 屏幕坐标和投影/透视矩阵。您至少需要知道这么多(如果您不知道投影矩阵,本质上您正在使用不同的相机来观察世界)。我们将每对 2D 屏幕坐标称为
(a_i, b_i)
,并且我假设投影矩阵的形式为几乎任何合理的投影都具有这种形式。通过渲染管道,您会发现
其中
(x_i, y_i, z_i)
是该点的原始 3D 坐标。现在,假设您知道一组规范坐标(无论您想要什么)中的形状,因此顶点为
(x0_i, y0_i, z0_i)
。我们可以将它们排列为矩阵 C 的列。形状的实际坐标是这些坐标的刚性变换。让我们以类似的方式将实际坐标组织为矩阵 V 的列。然后将它们关联起来,其中
1^T
是具有正确长度的行向量,R
是刚性变换的正交旋转矩阵,v
是变换的偏移向量。现在,上面的
V
的每一列都有一个表达式:第一列是{ s a_1 z_1 / px, s b_1 z_1 / py, z_1 }
等等。您必须求解标量集
z_i
的方程组(*)
,以及定义R
和v< 的刚性变换/代码>。
困难
R
和z_i
的商(*)
的满足程度如何;变换将是非刚性或非线性的。Let me say this up front: this problem is hard. There is a reason Dan Story's linked question has not been answered. Let provide an explanation for people who want to take a stab at it. I hope I'm wrong about how hard it is, though.
I will assume that the 2D screen coordinates and projection/perspective matrix is known to you. You need to know at least this much (if you don't know the projection matrix, essentially you are using a different camera to look at the world). Let's call each pair of 2D screen coordinates
(a_i, b_i)
, and I will assume the projection matrix is of the formAlmost any reasonable projection has this form. Working through the rendering pipeline, you find that
where
(x_i, y_i, z_i)
are the original 3D coordinates of the point.Now, let's assume you know your shape in a set of canonical coordinates (whatever you want), so that the vertices is
(x0_i, y0_i, z0_i)
. We can arrange these as columns of a matrixC
. The actual coordinates of the shape are a rigid transformation of these coordinates. Let's similarly organize the actual coordinates as columns of a matrixV
. Then these are related bywhere
1^T
is a row vector of ones with the right length,R
is an orthogonal rotation matrix of the rigid transformation, andv
is the offset vector of the transformation.Now, you have an expression for each column of
V
from above: the first column is{ s a_1 z_1 / px, s b_1 z_1 / py, z_1 }
and so on.You must solve the set of equations
(*)
for the set of scalarsz_i
, and the rigid transformation definedR
andv
.Difficulties
R
andz_i
(*)
will be satisfied; the transformation will be nonrigid or nonlinear.这称为(数字)摄影测量。开始谷歌搜索。
It's called (digital) photogrammetry. Start Googling.
如果您真的对这类问题(计算机视觉、用相机跟踪物体等中常见的问题)感兴趣,下面的书包含详细的处理:
Ma,Soatto,Kosecka,Sastry,< a href="http://vision.ucla.edu/MASKS/" rel="nofollow noreferrer">An Invitation to 3-D Vision,Springer 2004。
注意:这是一本高级工程文本,并使用许多技术本质上是数学的。浏览本书网页上的示例章节以获得一个想法。
If you are really interested in this kind of problems (which are common in computer vision, tracking objects with cameras etc.), the following book contains a detailed treatment:
Ma, Soatto, Kosecka, Sastry, An Invitation to 3-D Vision, Springer 2004.
Beware: this is an advanced engineering text, and uses many techniques which are mathematical in nature. Skim through the sample chapters featured on the book's web page to get an idea.