Skip to content

Instantly share code, notes, and snippets.

@Julioacarrettoni
Last active August 29, 2015 13:57
Show Gist options
  • Save Julioacarrettoni/9545604 to your computer and use it in GitHub Desktop.
Save Julioacarrettoni/9545604 to your computer and use it in GitHub Desktop.
#import <CoreImage/CoreImage.h>
#import <QuartzCore/QuartzCore.h>
- (BOOL) imageHasFaces:(UIImage*) originalImage {
if (originalImage == nil) {
return NO;
}
CIImage* image = originalImage.CIImage;
// If now available we create one using the CGImage
if (!image) {
image = [CIImage imageWithCGImage:originalImage.CGImage];
}
// Use the static CIDetector
CIDetector* detector = _faceDetector;
// create an array containing all the detected faces from the detector
NSArray* features = [detector featuresInImage:image];
return (features.count > 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment