用户登录
用户注册

分享至

使用CoreImage进行人脸识别

  • 作者: 生命於花
  • 来源: 51数据库
  • 2022-08-17
    - (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;  
    }  

软件
前端设计
程序设计
Java相关