UIImage+FaceDetection is an Objective-C category for UIImage
. It gives UIImage
the ability to return a 'CIFaceFeature' for each face found within the image.
- Add the CoreImage framework to your project
- Add the files 'UIImage+FaceDetection.h' & 'UIImage+FaceDetection.m' to your project
- Import the header using
#import "UIImage+FaceDetection.h"
- Call the
- (NSArray *)facesWithAccuracy :(NSString *)detectorAccuracy
method in the following way:
UIImage *myImage = [UIImage imageNamed:@"exampleImage.png"]; NSArray *faces = [myImage facesWithAccuracy:CIDetectorAccuracyHigh];
Return the largest face from the image
- (CIFaceFeature *)largestFaceWithAccuracy :(NSString *)detectorAccuracy
Return an image cropped around the largest face
- (UIImage *)croppedAroundLargestFaceWithAccuracy :(NSString *)detectorAccuracy
- Better handling when an invalid or nil 'CIDetectorAccuracy' is passed in.
- Return nil or error when no faces are found.
- Additional methods for returning smallest face.
- Additional methods for returning centre-most, left-most & right-most faces.
- Add podspec.
Released under ISC (similar to 2-clause BSD)