tformfwd 和 tforminv - 有什么区别?

发布于 2024-08-06 12:22:33 字数 580 浏览 4 评论 0 原文

假设我有一个任意变换矩阵 A,例如,

A =

    0.9966    0.0007   -6.5625
    0.0027    0.9938    1.0598
         0         0    1.0000

和一组点,其 x 和 y 坐标分别由 XY 表示。

假设,

[Xf Yf] = tformfwd(maketform('projective',A),X,Y);

现在,

[Xff Yff] = tformfwd(maketform('projective',inv(A)),Xf,Yf);
[Xfi Yfi] = tforminv(maketform('projective',A),Xf,Yf); 

[Xff Yff][Xfi Yfi] 似乎完全相同(而且它们应该)。

tforminv 只是为了方便还是我在这里遗漏了一些东西?

Suppose I have an arbitrary transformation matrix A such as,

A =

    0.9966    0.0007   -6.5625
    0.0027    0.9938    1.0598
         0         0    1.0000

And a set of points such that their x and y coordinates are represented by X and Y respectively.

And suppose,

[Xf Yf] = tformfwd(maketform('projective',A),X,Y);

Now,

[Xff Yff] = tformfwd(maketform('projective',inv(A)),Xf,Yf);
[Xfi Yfi] = tforminv(maketform('projective',A),Xf,Yf); 

[Xff Yff] and [Xfi Yfi] seem to be exactly the same (and they should).

Is tforminv just there for convenience or am I missing something here?

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

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

发布评论

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

评论(1

红尘作伴 2024-08-13 12:22:33

我会先说这是我的最佳猜测...

有可能tforminv 可以执行变换而不实际形成逆矩阵。例如,您可以通过两种方式求解线性方程组 Ax = b

x = inv(A)*b;
x = A\b;

根据 inv,第二个选项(使用矩阵除法运算符)“从执行时间和数值精度的角度来看”可以表现更好,因为它“使用高斯消元法产生解决方案,而不形成逆矩阵”。与将逆矩阵传递给 tforminv 可能会执行类似的操作,从而显示出更好的整体行为rel="nofollow noreferrer">tformfwd

如果您愿意,您可能可以尝试多种不同的变换矩阵并测试两种方法(tforminvtformfwdinv)查看结果的准确性以及计算结果的速度。

I'll preface this by saying it is my best guess...

It's possible that tforminv may perform the transformation without actually forming the inverse matrix. For example, you can solve a system of linear equations Ax = b in two ways:

x = inv(A)*b;
x = A\b;

According to the documentation for inv, the second option (using the matrix division operator) can perform better "from both an execution time and numerical accuracy standpoint" since it "produces the solution using Gaussian elimination, without forming the inverse". tforminv may do something similar and thus show better overall behavior compared with passing the inverse matrix to tformfwd.

If you were so inclined, you could probably try a number of different transformation matrices and test the two approaches (tforminv or tformfwd and inv) to see how accurate the results are and how fast they are each computed.

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