注意:这里的识别仅指识别出图片中包含人脸
#pragma mark - 人脸识别
- (BOOL)faceRecognition:(UIImage *)image {image = [image fixOrientation];
CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeFace
context:nil
options:nil];
CIImage *img_ci = [CIImage imageWithCGImage:image.CGImage];
NSArray *faceArray = [detector featuresInImage:img_ci options:nil];
if (faceArray.count > 0) {
return YES;
}
return NO;
}