FaceRecognitionLib is a library to recognize (not only detect) faces in an image. The library uses Eigenface (PCA) method for face recognition and can also be used for the recognition of any kind of objects, not only faces.

The library has a simple API based on input and events: the developer provides the library with a bitmap and listen to certain events (e.g. face detected or not detected). The corresponding event is fired based on the results. When the library detects faces in an image, it dispatches a face cropped event which has a vector with all those detected faces.


import com.oskarwicha.images.FaceRecognition.FaceRecognition;
import com.oskarwicha.images.FaceRecognition.Face;
import com.oskarwicha.images.FaceRecognition.Events.FaceEvent;
import com.oskarwicha.images.FaceRecognition.Events.FaceRecognitionEvent;

private var face:Face; // TODO: init with appropriate face
private var faceRecognition:FaceRecognition = new FaceRecognition();

faceRecognition.addEventListener(FaceRecognitionEvent.TRAINED, onFaceRecognitionTrained);
faceRecognition.addEventListener(FaceRecognitionEvent.LOADED_TRAINING_FACES, onFaceRecognitionLoadedTrainingFaces);
faceRecognition.addEventListener(FaceRecognitionEvent.PROBED, onFaceRecognitionProbed);

private function onFaceRecognitionTrained(e:Event):void {
	progressShower.htmlText += "System trained successfully.";

private function onFaceRecognitionLoadedTrainingFaces(e:Event):void {
	progressShower.htmlText += "All images from training set are now loaded.";

private function onFaceRecognitionProbed(e:FaceRecognitionEvent):void {
	progressShower.htmlText += "Face recognized as: " + e.classification;

faceRecognition.loadTrainingFaces(faceClasificationList, faceUrlList);
Computer Vision . URL.