根据原点更改前后的相机旋转/平移确定点位置
如果这是一个愚蠢的问题,我深表歉意,我对 3D 工作还很陌生。
我有许多带有 3x3 旋转矩阵和基于原点 (0,0,0) 的平移向量的针孔相机。
我正在使用的系统可以移动原点并旋转相机(尽管所有相机都保持相对于彼此),从而为每个相机生成一个新的旋转矩阵和平移向量,我可以访问它们。
那么我的问题是:给定原始空间中具有 3D 位置的点,如何使用同一相机(或多个相机)的新旋转/平移来计算新空间中同一点的 3D 位置?
当我提出问题时,是否有更有效的方法?
Apologies if this is a dumb question, i'm very new to working in 3D.
I have a number of pinhole cameras with a 3x3 rotation matrix and a translation vector based around the origin (0,0,0).
The system I'm working with can move the origin point and rotate the cameras (though all kept relative to one another), resulting in a new rotation matrix and translation vector for each camera, which I can access.
My question then, is: given a point with a 3D position in the original space, how does one compute the 3D position of the same point in the new space using the new rotation/translation of the same camera (or cameras)?
And while I'm asking questions, is there a more efficient means of doing so?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设你的点的位置是相对于原点矩阵的,你说它可以平移/旋转。
假设所有这些都是必要的,则您的点的新位置由下式给出:
您所做的就是获取新原点,将其转换回旧原点,然后取消旋转。另一种写法:
您可以预先计算逆运算,尤其是在使用 4d 矩阵时。
“如何根据相机的旋转和平移变化来确定原点的旋转和平移变化?” –OP
如果您没有被告知此信息,您可以按如下方式恢复。我们将使用 4d 点和 4v4 仿射变换矩阵 ( en.wikipedia.org/wiki/Affine_transformation )。
I assume that the position of your points are relative to the origin matrix, which you say can be translated/rotated.
Assuming all this is necessary, the new positions of your points are given by:
What you're doing is you're taking your new origin, translating it back to the old origin, and unrotating it. Written another way:
You can pre-calculate the inverse operations, especially if you're using 4d matrices.
"how to determine the change in rotation and translation for the origin based around the changes of rotation and translation for the cameras?" –OP
If you are not told this information, you can recover it as follows. We'll be using 4d points and a 4v4 affine transformation matrix ( en.wikipedia.org/wiki/Affine_transformation ).
我建议使用 齐次坐标 来跟踪矩阵和变换。我认为你的问题是如何在不同的相机视图之间来回转换点。
如果将相机变换表示为单个矩阵运算
M
,那么向后就是inverse(M)
。更好的是,如果您的相机矩阵是由多个步骤组成的,您可以反转这些步骤。例如,如果M=rotatex(theta) * scale(sx, sy, sz) * translate(x, y, z)
,则inverse(M) = translate(-x, - y,-z)*缩放(1/sx,1/sy,1/sz)*旋转x(-theta)
。请注意,您还必须颠倒顺序。这是“袜子/鞋子”属性。你穿上袜子,然后穿上鞋子。要反转,请脱掉鞋子,然后脱掉袜子。一旦您可以从每个摄像机向前和向后移动,您就可以轻松地在任何摄像机视图之间交换点。
I would recommend using homogeneous coordinates to keep track of matrices and transformations. I think your question is how do you transform points back and forth between different camera views.
If you represent a camera transformation as a single matrix operation
M
, then going backwards is justinverse(M)
. Even better, if your camera matrix is the composition of several steps you can invert the steps. For example ifM=rotatex(theta) * scale(sx, sy, sz) * translate(x, y, z)
, theninverse(M) = translate(-x, -y, -z) * scale(1/sx, 1/sy, 1/sz) * rotatex(-theta)
. Notice you also have to reverse the order. It's the "socks/shoes" property. You put on your socks, then put on your shoes. To reverse you take off your shoes, then take off your socks.Once you can go forward and backward from each camera, you can swap points between any camera view easily.