May 30-June 30 (1): Fisherfaces Algorithm Finished For DigiKam

Fisherfaces Algorithm (Background)
Face recognition is a key problem in computer vision. One way to represent the input data is by finding a subspace which represents most of the data variance. This can be obtained with the use of Principal Components Analysis (PCA). When applied to face images, PCA yields a set of eigenfaces. These eigenfaces are the eigenvectors associated to the largest eigenvalues of the covariance matrix of the training data. The eigenvectors thus found correspond to the least-squares (LS) solution. This is indeed a powerful way to represent the data because it ensures the data variance is maintained while eliminating unnecessary existing correlations among the original features (dimensions) in the sample vectors.[1] This is the core idea of Eigenfaces algorithm
When the goal is classification rather than representation, the LS solution may not yield the most desirable results. In such cases, one wishes to find a subspace that maps the sample vectors of the same class in a single spot of the feature representation and those of different classes as far apart from each other as possible. The techniques derived to achieve this goal are known as discriminant analysis (DA).[1]
The most known DA is Linear Discriminant Analysis (LDA), which can be derived from an idea suggested by R.A. Fisher in 1936. When LDA is used to find the subspace representation of a set of face images, the resulting basis vectors defining that space are known as Fisherfaces.
Unlike Eigenfaces, Fisherfaces using LDA for face recognition, which is better in classification rather than representation. As usual, I wrote test code for Fisherfaces in OpenCV and pushed it into the demo project. I use orl face database which include 40 people's face images with 10 images of each person. I use 8 images of each person as traing images, and another 2 as test images, and the result is 74 true positive, 6 false positive which is acceptable.
Modification Details
My work including 3 parts like my work in Eigenfaces:
(1) UI modification. I added algorithm option of Fisherfaces in advanced tab, which is shown in the screenshot below:(My mentor suggest me to use a QComboBox, and I will change it later)

(2) Algorithm Selection. The program has to use Fisherfaces algorithm which is chosen by user which including:
(a) Create a new Fisherfaces model.
(b) Read training data from face database (the same table as Eigenfaces).
(c) Add new labeled face as trainging data.
(d) Training by calculate eigenvectors and using LDA.
(e) Recognizing a new face.
(3) Fisherfaces algorithm. This is core part of my work. In this part, I created the Fisherfaces model, including training, recognizing, and reading/saving data from database. A threshold can be set by experience which is used to decide a face is unknown or not.
Code details
I have commited my code in my devel branch. You can read and test my work there.

I used a small face data set to test like testing Eigenfaces, the next several screenshots are faces before recognition and after recognition.
Before recognition:

Images in tag "jayjay" after recognition:

Images in tag "Robert" after recognition: