首页 > 其他 > 详细

使用CoreImage进行人脸识别

时间:2014-12-25 14:37:17      阅读:297      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!