This post gets some attention, so I would like to update it. I implemented the face recognition library that I wrote in OpenCV, which includes histograms of my own and histograms and local binary patterns while writing this. So, now OpenCV 2.4.2 comes with everything to get started, see very detailed documentation:
Now the original answer.
I am the author of an article related to Kevin's post. Please note that you need to find the eigenvalues ββof the asymmetric matrix S_ {W} ^ {- 1} S_ {B} for Fisherfaces, I did not mention this directly in my blog. OpenCV only has a solver for symmetric matrices in its current version; since eigenvalues ββand singular values ββare not equivalent for asymmetric matrices, you also cannot use SVD. For my project, I adapted the JAMA solution to C ++ to solve the eigenvalue problem for asymmetric matrices, so there is no need to use an external library for it. CMakeLists.txt is configured, so Eigen can also be used, so you have a choice.
Now I finally found a few minutes to implement the Fisherfaces method using the OpenCV2 C ++ API and injected the code into my github account at:
main.cpp shows you how to use the Fisherfaces class and how to use linear discriminant analysis with the same example as on: http://www.bytefish.de/wiki/pca_lda_with_gnu_octave . It comes as a CMake project, so compiling is as simple as typing:
philipp@mango :~/some/dir$ mkdir build; cd build philipp@mango :~/some/dir/build$ cmake .. philipp@mango :~/some/dir/build$ make philipp@mango :~/some/dir/build$ ./lda
I don't know if Stackoverflow is the preferred way to send code back, but I think it's too long to post.
Pay attention to two things. (1) I read the images from the CSV file ( like this one ), you donβt need to care about the order of the labels, (2) I save my own vectors in a column, and the PCA in OpenCV stores them in a row. This is just a matter of personal taste, but I have never seen this for any other solver, and so I decided to keep them in columns.
source share