OpenCV 中两个矩阵的广义特征值
您好,我正在开展一个涉及人脸识别的项目,我正在使用线性判别分析(LDA)。 LDA 要求找到类间散布矩阵和类内散布矩阵的广义特征向量,这就是令我震惊的地方。我使用 opencv 和 DevC++ 进行编码。基本上,问题看起来像
A*v=lambda*B*v
A 和 B 是应该找到广义特征向量的矩阵 lambda 是特征值,v 是向量
在搜索这个问题时,很多人建议先计算 B 的逆,然后与 A*v 相乘
(inv(B)*A)*v=lambda*v
,然后计算 inv(B)*A 的特征向量。
这似乎是一个很好的解决方案,但在我的例子中,散布矩阵 B 几乎是奇异的。我发现它的行列式的数量级是 10^-36 。所以我找不到它的逆矩阵并继续上面的解决方案。那么有人可以建议我一种解决这个问题的方法吗,除了说单独编码广义特征值问题之外。
Hello I am working on a project involving in face recognition for which I am using Linear Discriminant Analysis(LDA). LDA demands to find the generalized eigen vectors for the between class scatter matrix and with in class scatter matrix and that is where I am struck. I am using opencv with DevC++ for coding. Basically the problem looks like
A*v=lambda*B*v
where A and B are matrices for which generalized eigen vectors should be found
lambda is eigen values and v is vectors
Upon searching about this problem many people suggested to go for calculating the inverse of B and then multiplying with A*v
(inv(B)*A)*v=lambda*v
and then calculate eigen vectors for inv(B)*A.
It seems to be a good solution but in my case the scatter matrix B is almost sigular. I found its determinant is in the order of 10^-36 .So I cant find its inverse and proceed with the above solution. So Can some one suggest me a way to get out of this problem except saying to code for generalized eigen value problem separately.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在我的 github 存储库中提供了 Fisherfaces 实现,网址为 https://github.com/bytefish/ opencv/tree/master/lda。这包括一般矩阵的特征值求解器的实现,请参阅:https ://github.com/bytefish/opencv/blob/master/lda/include/decomposition.hpp(我已经移植了伟大的JAMA 求解器),这正是您正在寻找的。
如果您对代码有疑问,请在项目页面上给我留言 http://www.bytefish .de/blog/fisherfaces_in_opencv。
I am providing a Fisherfaces implementation in my github repository at https://github.com/bytefish/opencv/tree/master/lda. This includes the implementation of an eigenvalue solver for general matrices, see: https://github.com/bytefish/opencv/blob/master/lda/include/decomposition.hpp (I've ported the great JAMA solver), which is exactely what you are looking for.
If you have problems with the code, please drop me a note on the projects page at http://www.bytefish.de/blog/fisherfaces_in_opencv.