使用CoreImage进行人脸识别
2018-07-20 来源:open-open
- (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;
}
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。
上一篇:汉字转拼音源码(C#)
下一篇:Java文件下载
最新资讯
热门推荐