Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

76 lines (51 sloc) 3.705 kb

!!!!!!!!!!!!!!!!!!!!!!!!!!! #

NOTE

!!!!!!!!!!!!!!!!!!!!!!!!!!! #

PLEASE USE LIBFACEREC

This repository is here for educational purpose, as it might be interesting to someone. Please use libfacerec at:

This contains all these algorithms with Unit Tests and a nice API.

bytefish/opencv/lda

This project implements the Fisherfaces method as described in: P. Belhumeur, J. Hespanha, and D. Kriegman, "Eigenfaces vs. Fisherfaces: Recognition Using Class Specific Linear Projection", IEEE Transactions on Pattern Analysis and Machine Intelligence, 19(7):711--720, 1997.

Building the Project

This project has no additional dependencies, so compiling the project is as easy as writing (assuming you are in this folder):

philipp@mango:~/some/dir/lda$ mkdir build
philipp@mango:~/some/dir/lda$ cd build
philipp@mango:~/some/dir/lda/build$ cmake ..
philipp@mango:~/some/dir/lda/build$ make
philipp@mango:~/some/dir/lda/build$ ./lda filename.ext

And if you are in Windows using MinGW it may look like this:

C:\some\dir\lda> mkdir build
C:\some\dir\lda> cd build
C:\some\dir\lda\build> cmake -G "MinGW Makefiles" ..
C:\some\dir\lda\build> mingw32-make
C:\some\dir\lda\build> lda.exe filename.ext

You probably have to set the OpenCV_DIR variable if it wasn't added by your installation, see Line 5 in the CMakeLists.txt how to do this. If you have problems working with CMake or installing OpenCV, you probably want to read my guide on Face Recognition with OpenCV2.

Using the Project

The project comes with an example, please have a look at the main.cpp on how to use the classes. You need some data to make the examples work, sorry but I really can't include those face databases in my repository. I have thoroughly commented the code and reworked it lately, to make its usage simpler. So if anything regarding the classes is unclear, please read the comments.

In the example I use a CSV file to read in the data, it's the easiest solution I can think of right now. However, if you know a simpler solution please ping me about it. Basically all the CSV file needs to contain are lines composed of a filename followed by a ; followed by the label (as integer number), making up a line like this: /path/to/image.ext;0.

Think of the label as the subject (the person) this image belongs to, so same subjects (persons) should have the same label. An example CSV file for the AT&T Facedatabase is given here, which looks like this (assuming I've extracted the database to /home/philipp/facerec/data/at, file is without ... of course):

/home/philipp/facerec/data/at/s1/1.pgm;0
/home/philipp/facerec/data/at/s1/2.pgm;0
...
/home/philipp/facerec/data/at/s2/1.pgm;1
/home/philipp/facerec/data/at/s2/2.pgm;1
...
/home/philipp/facerec/data/at/s40/1.pgm;39
/home/philipp/facerec/data/at/s40/2.pgm;39

Once you have a CSV file with valid filenames and labels, you can run the demo by simply starting the demo with the path to the CSV file as parameter:

./lda /path/to/your/csvfile.ext

Or if you are in Windows:

lda.exe /path/to/your/csvfile.ext

License

All code is put under a BSD license, so feel free to use it for your projects.

Jump to Line
Something went wrong with that request. Please try again.