Face Recognition on the iPhone

前端 未结 5 1559
遇见更好的自我
遇见更好的自我 2020-12-02 05:57

How can I do facial recognition on the iPhone. Could someone provide me with references/articles to point me in the right direction please? I have done research and realised

5条回答
  •  情书的邮戳
    2020-12-02 06:54

    As you pointed out, the first step (detection of the face) is easy with iOS 5 and CoreImage.framework. Quick example:

    CIImage *image = [CIImage imageWithCGImage:image_ref];
    NSDictionary *options = [NSDictionary dictionaryWithObject:CIDetectorAccuracyHigh forKey:CIDetectorAccuracy];
    CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:options];
    NSArray *features = [detector featuresInImage:image];
    
    for (CIFaceFeature *feature in features)
    {
      CGRect face_bounds = [feature bounds];
      CGPoint mouth_position = [feature mouthPosition];
      // do something with these values
    }
    

    With regards to the second part of your question (i.e. facial recognition), I shall leave that to someone more qualified than myself to answer. :)

提交回复
热议问题