Veronika Å trbÃ¡kovÃ¡
The project shows detection and recognition of face and eyes from input image (webcam). I use for detection and classification haarcascade files from OpenCV. If eyes are recognized, I classify them as opened or narrowed. The algorithm uses theÂ OpenCV and SVMLightÂ library.
Functions used: CascadeClassifier::detectMultiScale, HOGDescriptor::compute HOGDescriptor::setSVMDetector, SVMTrainer::writeFeatureVectorToFile
- As first I make positive and negative dataset. Positive dataset are photos of narrowed eyes and negative dataset are photos of opened eyes.
- Then I make HOGDescriptor and I use it to compute feature vector for every picture. These pictures are used to train SVM vector and their feature vectors are saved to one file: features.dat
HOGDescriptor hog; vector<float> featureVector; SVMLight::SVMTrainer svm("features.dat"); hog.compute(img, featureVector, Size(8, 8), Size(0, 0)); svm.writeFeatureVectorToFile(featureVector, true);
- From feature vectors I compute single descriptor vector and I set him to my HOGDescriptor.
SVMLight::SVMClassifier c("classifier.dat"); vector descriptorVector = c.getDescriptorVector(); hog.setSVMDetector(descriptorVector);
- I detect every face and every eye from picture. For every found picture of eye I cut it and I use HOGDescriptor to detect narrowed shape of eye.