Iphone CIFaceFeature仅适用于LandscapeLeft
下面介绍如何进行人脸检测(教程仅在视频中提供,未在线编写,因此我无法发布直接链接)。基本上,我已经让人脸检测开始工作,但前提是手机处于LandscapeLeft模式Iphone CIFaceFeature仅适用于LandscapeLeft,iphone,ios,orientation,face-detection,Iphone,Ios,Orientation,Face Detection,下面介绍如何进行人脸检测(教程仅在视频中提供,未在线编写,因此我无法发布直接链接)。基本上,我已经让人脸检测开始工作,但前提是手机处于LandscapeLeft模式 你知道为什么会这样吗?没有看到你的代码很难说,但我猜你没有设置CIDetectorImageOrientation?当图像方向与探测器方向设置不匹配时,检测失败 下面的一些代码-不是剪切粘贴,而是一个粗略的示例 - (void)detectFacialFeatures:(UIImage *)image withHighAccurac
你知道为什么会这样吗?没有看到你的代码很难说,但我猜你没有设置
CIDetectorImageOrientation
?当图像方向与探测器方向设置不匹配时,检测失败
下面的一些代码-不是剪切粘贴,而是一个粗略的示例
- (void)detectFacialFeatures:(UIImage *)image withHighAccuracy:(BOOL) highAccuracy
{
CIImage* ciImage = [CIImage imageWithCGImage:sourceImage.CGImage];
if (ciImage == nil){
printf("ugh \n");
// bail
}
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSString *accuracy = highAccuracy ? CIDetectorAccuracyHigh : CIDetectorAccuracyLow;
NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:
CIDetectorAccuracyHigh, CIDetectorAccuracy,
orientation, CIDetectorImageOrientation,
nil];
CIDetector* detector = [CIDetector detectorOfType:CIDetectorTypeFace
context:nil options:options];
NSArray *features = [detector featuresInImage:ciImage];
NSLog(@"features %@", features);
});
}
没有看到您的代码很难说,但我猜您没有设置
CIDetectorImageOrientation
?当图像方向与探测器方向设置不匹配时,检测失败
下面的一些代码-不是剪切粘贴,而是一个粗略的示例
- (void)detectFacialFeatures:(UIImage *)image withHighAccuracy:(BOOL) highAccuracy
{
CIImage* ciImage = [CIImage imageWithCGImage:sourceImage.CGImage];
if (ciImage == nil){
printf("ugh \n");
// bail
}
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSString *accuracy = highAccuracy ? CIDetectorAccuracyHigh : CIDetectorAccuracyLow;
NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:
CIDetectorAccuracyHigh, CIDetectorAccuracy,
orientation, CIDetectorImageOrientation,
nil];
CIDetector* detector = [CIDetector detectorOfType:CIDetectorTypeFace
context:nil options:options];
NSArray *features = [detector featuresInImage:ciImage];
NSLog(@"features %@", features);
});
}
耶!别忘了接受答案。我得到的分数越多。。。我们做妓女有什么好处?我忘了。:-)耶!别忘了接受答案。我得到的分数越多。。。我们做妓女有什么好处?我忘了。:-)