码迷,mamicode.com
首页 > 其他好文 > 详细

使用CoreImage进行人脸识别

时间:2014-12-25 14:39:39      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:

代码

- (BOOL)checkImageHasFace
{
    BOOL hasFace = NO;
    CIImage *begingImage = [[CIImage alloc] initWithImage:_postImage];
    //创建CIDetector对象,options使用NSDictionary设置采用高品质还是低品质,这里使用低品质。
    CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:[NSDictionary dictionaryWithObject:CIDetectorAccuracyLow forKey:CIDetectorAccuracy]];
    //返回数组中包含图片脸部特征信息
    NSArray *faceFeatures = [detector featuresInImage:begingImage];
    for (CIFaceFeature *faceFeature in faceFeatures) {
        //左眼位置、右眼位置和嘴的位置
        if (faceFeature.hasLeftEyePosition&&faceFeature.hasRightEyePosition&&faceFeature.hasMouthPosition) {
            hasFace = YES;
        }
    }
    return hasFace;
}


使用CoreImage进行人脸识别

标签:

原文地址:http://blog.csdn.net/nextstudio/article/details/42145383

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!