Slide 21
Slide 21 text
(Simplified) Code Sample
NSDictionary *detectorOptions = @{CIDetectorAccuracy : CIDetectorAccuracyLow,
CIDetectorTracking : @YES};
!
self.faceDetector = [CIDetector detectorOfType:CIDetectorTypeFace
context:nil
options:detectorOptions];
NSDictionary *imageOptions = @{CIDetectorImageOrientation: imageOrientation};
NSArray *features = [self.faceDetector featuresInImage:ciImage
options:imageOptions];
cv::Ptr _model = cv::createEigenFaceRecognizer();
_model->train(images, labels);
for each face {
int predictedLabel = -1;
double confidence = 0.0;
cv::Mat onlyTheFace;
cv::cvtColor(cvImage(face.bounds), onlyTheFace, CV_RGB2GRAY);
cv::resize(onlyTheFace, onlyTheFace, cv::Size(100, 100), 0, 0);
_model->predict(onlyTheFace, predictedLabel, confidence);
}
21
Monday 9 September 13