矩阵对数算法
OpenCV中有没有计算矩阵对数的方法?我知道它不能作为库函数使用,但是,指向良好来源(论文、教科书等)的指针将不胜感激。
is there any way to compute the matrix logarithm in OpenCV? I understand that it's not available as a library function, but, pointers to a good source (paper, textbook, etc) will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实上,我正在 Eigen 库中对矩阵对数进行编程,该库显然在一些 Willow Garage 库中使用;不确定 OpenCV。 Higham 的书(参见 aix 的回答)是我认为最好的参考书,我正在他的书中实现算法 11.11。但这是一个相当复杂的算法。
对角化(如亚历山大的评论)是一种易于编程的方法,对于对称正定矩阵非常有效。它也适用于许多一般矩阵。然而,对于特征值接近的矩阵来说,它并不准确,对于不可对角化的矩阵,它也失败。
如果您想要比对角化更强大但比 Higham 算法 11.11 简单的东西,那么我建议进行 Schur 分解,然后进行逆缩放和平方。这是 Higham 书中的算法 11.10,并在论文“Approximating the Logarithm of a Matrix to Specified Accuracy”( http://dx.doi.org/10.1137/S0895479899364015,预印本位于 http: //eprints.ma.man.ac.uk/318/)。
As a matter of fact, I'm in the process of programming the matrix logarithm in the Eigen library which is apparently used in some Willow Garage libraries; not sure about OpenCV. Higham's book (see answer by aix) is the best reference in my opinion and I'm implementing Algorithm 11.11 in his book. That is a rather complicated algorithm though.
Diagonalization (as in Alexandre's comment) is an easy-to-program method which works very well for symmetric positive definite matrices. It also works well for many general matrices. However, it is not accurate for matrices whose eigenvalues are close together, and it fails for matrices that are not diagonalizable.
If you want something more robust than diagonalization but less complicated than Higham's Algorithm 11.11 then I'd recommend to do a Schur decomposition followed by inverse scaling and squaring. This is Algorithm 11.10 in Higham's book, and described in the paper "Approximating the Logarithm of a Matrix to Specified Accuracy" (http://dx.doi.org/10.1137/S0895479899364015, preprint at http://eprints.ma.man.ac.uk/318/).
如果您使用OpenCV矩阵,您可以轻松地将它们映射到Eigen3矩阵。请参阅这篇文章:
OpenCV CV::Mat 和 Eigen::Matrix
然后,Eigen3 库有一个矩阵对数函数,您可以使用:
http://eigen.tuxfamily.org/dox/unsupported/group__MatrixFunctions__Module.html
位于不受支持的模块下,但这不是问题,这只是意味着:
希望这对您有所帮助。
If you use OpenCV matrices, you can easily map them to Eigen3 matrices. See this post:
OpenCV CV::Mat and Eigen::Matrix
Then, Eigen3 library has a matrix logarithm function that you can use:
http://eigen.tuxfamily.org/dox/unsupported/group__MatrixFunctions__Module.html
it is under the unsupported module, but this is not an issue, this just means:
Hope this is of help.