在这种情况下有没有确定 3d 位置的算法? (下图)

发布于 2024-08-27 04:42:44 字数 658 浏览 8 评论 0原文

所以首先我有这样的图像(当然我有二维的所有点坐标,这样我就可以重新生成线并检查它们相互交叉的位置)

替代文本
(来源: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)

alt text
(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
alt text
(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

谈情不如逗狗 2024-09-03 04:42:44

您试图找到的称为投影矩阵。确定精确的逆投影通常需要您在源向量和目标向量中牢固地建立坐标,而上面的图像不会为您提供这些坐标。不过,您可以使用像素位置进行近似。

此帖子将为您提供基本的演练您需要使用的技术。

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.

过潦 2024-09-03 04:42:44

我先说一下:这个问题很难。丹·斯托里的相关问题尚未得到解答是有原因的。让我们为那些想尝试一下的人提供一个解释。不过,我希望我对这件事的难度的判断是错误的。

我假设您知道 2D 屏幕坐标和投影/透视矩阵。您至少需要知道这么多(如果您不知道投影矩阵,本质上您正在使用不同的相机来观察世界)。我们将每对 2D 屏幕坐标称为 (a_i, b_i),并且我假设投影矩阵的形式为

P = [ px  0  0  0 ]
    [ 0   py 0  0 ]
    [ 0   0  pz pw]
    [ 0   0  s  0 ], s = +/-1

几乎任何合理的投影都具有这种形式。通过渲染管道,您会发现

a_i = px x_i / (s z_i)
b_i = py y_i / (s z_i)

其中 (x_i, y_i, z_i) 是该点的原始 3D 坐标。

现在,假设您知道一组规范坐标(无论您想要什么)中的形状,因此顶点为(x0_i, y0_i, z0_i)。我们可以将它们排列为矩阵 C 的列。形状的实际坐标是这些坐标的刚性变换。让我们以类似的方式将实际坐标组织为矩阵 V 的列。然后将它们关联起来,

V = R C + v 1^T             (*)

其中 1^T 是具有正确长度的行向量,R 是刚性变换的正交旋转矩阵,v 是变换的偏移向量。

现在,上面的 V 的每一列都有一个表达式:第一列是 { s a_1 z_1 / px, s b_1 z_1 / py, z_1 } 等等。

您必须求解标量集 z_i 的方程组 (*),以及定义 Rv< 的刚性变换/代码>。

困难

  • 方程在未知数中是非线性的,涉及Rz_i的商
  • 到目前为止我们假设您知道哪个2D坐标对应于原始形状的哪些顶点(如果您的形状是正方形,这问题稍微小一些)。
  • 我们假设甚至有一个解决方案;如果二维数据存在错误,那么很难说方程 (*) 的满足程度如何;变换将是非刚性或非线性的。

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 form

P = [ px  0  0  0 ]
    [ 0   py 0  0 ]
    [ 0   0  pz pw]
    [ 0   0  s  0 ], s = +/-1

Almost any reasonable projection has this form. Working through the rendering pipeline, you find that

a_i = px x_i / (s z_i)
b_i = py y_i / (s z_i)

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 matrix C. The actual coordinates of the shape are a rigid transformation of these coordinates. Let's similarly organize the actual coordinates as columns of a matrix V. Then these are related by

V = R C + v 1^T             (*)

where 1^T is a row vector of ones with the right length, R is an orthogonal rotation matrix of the rigid transformation, and v 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 scalars z_i, and the rigid transformation defined R and v.

Difficulties

  • The equation is nonlinear in the unknowns, involving quotients of R and z_i
  • We have assumed up to now that you know which 2D coordinates correspond to which vertices of the original shape (if your shape is a square, this is slightly less of a problem).
  • We assume there is even a solution at all; if there are errors in the 2D data, then it's hard to say how well equation (*) will be satisfied; the transformation will be nonrigid or nonlinear.
狼性发作 2024-09-03 04:42:44

这称为(数字)摄影测量。开始谷歌搜索。

It's called (digital) photogrammetry. Start Googling.

天冷不及心凉 2024-09-03 04:42:44

如果您真的对这类问题(计算机视觉、用相机跟踪物体等中常见的问题)感兴趣,下面的书包含详细的处理:

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文