Also, I can say that it is a pretty good framework.
You can have the Java sources from :
https://faint.svn.sourceforge.net/svnroot/faint
It is based on Eigenfaces algorithm.
Few words about Eigenfaces.
What people is trying to do in a face recognition application is to extract particular information eliminating unnecessary data like : noise, illumination or pose. What should be extracted from the input data are objects like : eyes, nose or mouth. These objects are called generally principal components or eigenfaces. These components can be extracted through a mathematical technique named Principal Components Analysis (PCA).
Eigenvectors and eigenvalues
An eigenvector of a matrix is a vector such that, if multiplied with the matrix, the result is always an integer multiple of that vector. This integer value is the corresponding eigenvalue of the eigenvector. This relationship can be described by the equation M × v = lambda ×v, where v is an eigenvector of the matrix M and lambda is the corresponding eigenvalue.
Eigenvectors possess following properties:
- They can be determined only for square matrices
- There are n eigenvectors (and corresponding eigenvalues) in a n × n matrix.
- All eigenvectors are perpendicular, i.e. at right angle with each other.
The FAINT library uses Intel OpenCV DLL for image processing, face detection and recognition. But, don't worry. All you have to do is to add the FAINT jar file to your project's classpath.
The Java source for face detection :
import de.offis.faint.controller.MainController;
import de.offis.faint.model.ImageModel;
import de.offis.faint.model.Region;
import java.io.File;
import java.io.IOException;
import java.util.Random;
public class Main {
private static final String imageSourceDir = "C:\\my_images";
private static final String thumbnailDestDir = "C:\\Users\\daniel\\.faint";
private static final String separator = "\\";
private static final Random randomGenerator = new Random();
private static final boolean moveThumbnails = true;
public static void main(String[] args) throws IOException {
//initialize main controller, OpenCV DLL and filters
MainController controller = MainController.getInstance();
if (controller != null) {
controller.setScanWindowSize(1);
// create an image model from the used photo file
ImageModel imageModel = new ImageModel(imageSourceDir + separator + "image1.JPG");
imageModel.initThumbnail();
// detect the face
Region[] regions = controller.detectFaces(imageModel, false);
if (regions != null) {
System.out.println(regions.length + " people in the image...");
for (int i = 0; i < regions.length; i++) {
Region region = regions[i];
region.cacheToDisk();
//if face thumbnail image required
if (moveThumbnails) {
String cacheFilename = region.getCachedFile();
// write the face image to disk
File file = new File(thumbnailDestinationDir + separator + cacheFilename);
File dir = new File(imageSourceDir + separator + "faces");
boolean success = file.renameTo(new File(dir, "face_" + randomGenerator.nextInt() + ".png"));
if (!success) {
System.out.println("Error occured while moving " + cacheFilename);
}
}
}
}
}
}
}
The output should be similar to this one :
Preparing face database...
Loading Modules...
>> OpenCVDetection
>> BetafaceDetection
>> SkinColorFilter
>> EigenfaceRecognition
>> SimpleContextFilter
1 people in the image...
Error occured while moving 00000072.png
Preparing face detection...
C:\Users\Daniel\.faint\opencv\haarcascade_frontalface_default.xml loaded!.
Even it says : 'Error occured while moving xxxx.png', the face thumbnail file will be created in the
Enjoy using FAINT.
References :
Eigenfaces
1. http://www.cs.ucsb.edu/~mturk/Papers/mturk-CVPR91.pdf
2. http://en.wikipedia.org/wiki/Eigenface
3. http://openbio.sourceforge.net/resources/eigenfaces/eigenfaces-html/facesOptions.html
Intel OpenCV
1. http://sourceforge.net/projects/opencvlibrary/
2. http://opencv.willowgarage.com/wiki/
3. http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134