反转仿射变换——如何更新中心坐标?

发布于 2024-09-03 10:29:14 字数 315 浏览 4 评论 0原文

所以我有一个 3D 图像,它通过仿射变换转换成空间。该变换由传统的 4x4 矩阵加上执行变换的中心坐标组成。我怎样才能反转该中心点以回到原始空间?我有坐标,但它是 1x3 向量(或 3x1,取决于行/列顺序)。我假设要获得适当的逆中心,我需要将向量变为 1x4,但如果是这样,我应该将什么放入第四个位置?明显的候选者是 0 和 1,但我不确定这是否是正确的做法。

这个想法是,如果我将图像变换到空间中,然后反转变换,则生成的图像应该是相同的(在舍入误差/重采样的锯齿效应范围内)。然而,目前,我只是使用相同的中心坐标,这会生成一个移动一定量的图像,而不是生成完全相同的图像。那么,如何变换该中心点呢?

So I have a 3D image that's getting transformed into a space via an affine transform. That transform is composed of the traditional 4x4 matrix plus a center coordinate about which the transform is performed. How can I invert that center point in order to go back into the original space? I have the coordinate, but its a 1x3 vector (or 3x1, depending on row/column order). I assume that to do get the appropriate center of the inverse, I need to make the vector into 1x4, but if that's the case, what should I put into the fourth position? Obvious candidates are 0 and 1, but I'm not sure if that's the Right Thing to do.

The idea is that if I transform an image into the space, and then invert the transform, the resulting image should be identical (within rounding errors/aliasing effects from resampling). However, at the moment, I'm just using the same center coordinate, and that's producing an image that's shifted by some amount rather than producing the exact same image. So, how can I transform that center point?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

謌踐踏愛綪 2024-09-10 10:29:14

我假设你的转换是这样的

x' = Mx + t

求解 x 应该给出

x = M_inv (x' - t) 

在 3D 坐标系中使用 4x4 矩阵通常意味着在齐次坐标中工作。您将乘法值存储在第四个坐标中,通常称为 w。值 1 适用于位置,值 0 适用于向量。这是因为存储在矩阵 M 中的平移信息应该只影响位置(这是一个非常基本的解释,抱歉)。所以,是的,否定平移向量应该已经可以解决问题了。添加 0 作为第四个分量。

I assume your transformation goes like this

x' = Mx + t

Solving for x should give

x = M_inv (x' - t) 

Working with 4x4 matrices in a 3D coordinate system usally mean working in homogeneous coordinates. You store a multiplicative value in the 4th coordinate that is usally called w. The value 1 works well for positions, the value 0 is meant for vectors. That's because the translation information stored in matrix M should affect only positions (this is a very basic explanation, sorry). So, yes, negating the translation vector should already do the trick. Add 0 as 4th component.

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