Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top