Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
548 views
in Technique[技术] by (71.8m points)

computer vision - C++ face detection/recognition implementations

I'd have thought that google could answer this question, but I've not had much luck.

Does anyone know of any open source C++ implementations of any face detection algorithms other than the Viola-Jones (boosted cascades of Haar-like features) method?

Also, does there exist an open source C++ implementation of Fisherfaces anywhere?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This post gets some attention, so I'd like to update it. I've contributed the face recognition library I wrote to OpenCV, which includes Eigenfaces, Fisherfaces and Local Binary Patterns Histograms at time of writing this. So OpenCV 2.4.2 now comes with everything to get started, see the very detailed documentation:

Now the original answer.

I am the author of the article linked in Kevin's post. Please note that you need to find the eigenvalues of the non-symmetric matrix S_{W}^{-1} S_{B} for the Fisherfaces, I didn't explicitly mention it in my blog. OpenCV only has a solver for symmetric matrices in its current version; since eigenvalues and singular values aren't equivalent for non-symmetric matrices you can't use a SVD either. For my project I have adapted the JAMA solver to C++ for solving the eigenvalue problem for non-symmetric matrices, so there's no need to use an external library for it. The CMakeLists.txt is configured, so Eigen can be used as well, so you have the choice.

Now I've finally found some minutes to implement the Fisherfaces method with the OpenCV2 C++ API and pushed the code into my github account at:

The main.cpp shows you how to use the Fisherfaces class and how to use the 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 easy 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 it's the preferred Stackoverflow way to post code in the answer, but I think it's a bit too long to post.

Please note two things. (1) I read the images from a CSV file (just like this one), you don't have to care about the order of the labels. (2) I store the eigenvectors by column, while the PCA in OpenCV stores them by row. It's just a matter of personal taste to do so, but I've never seen that for any other solver and so I decided to store them by column.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...