Skip to content

Instantly share code, notes, and snippets.

@chalkers
Created December 5, 2011 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chalkers/1435273 to your computer and use it in GitHub Desktop.
Save chalkers/1435273 to your computer and use it in GitHub Desktop.
Face Detection
//Have a UIImage *image
NSDictionary *detectorOptions = [[NSDictionary alloc] initWithObjectsAndKeys:CIDetectorAccuracyHigh, CIDetectorAccuracy, nil];
CIDetector *faceDetector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:detectorOptions];
CIImage *ciImage = [CIImage imageWithCGImage:[image CGImage]];
NSArray *features = [faceDetector featuresInImage:ciImage];
// features.count == 0 No faces
// features.count == 1 One face.
// features.count > 1 More than one :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment