iOS 人脸检测在模拟器和设备中的工作方式不同
我正在尝试使用 iOS 5 面部检测,我发现当我在模拟器上运行代码时,它会检测到具有正确框架的面部。但是,如果我在设备上的同一张图像上运行完全相同的代码,它会返回不正确的尺寸。 这是我的代码:
CIImage* image = [CIImage imageWithCGImage:someImage.CGImage];
NSDictionary *detectorOptions =
[NSDictionary dictionaryWithObjectsAndKeys:
CIDetectorAccuracyHigh, CIDetectorAccuracy,
nil];
CIDetector* detector = [CIDetector detectorOfType:CIDetectorTypeFace
context:nil
options:detectorOptions];
NSArray *faceFeatures = [detector featuresInImage:image];
for (CIFeature *f in faceFeatures) {
NSLog(@"Feature: %@", NSStringFromRect(f.bounds));
}
模拟器的输出(正确): 特征:{{78, 153}, {200, 200}}
设备的输出(不正确): 功能:{{104, 199}, {272, 272}}
这是一个错误吗?还是我使用人脸检测代码不当?我还尝试使用 featuresInImage:options 并传入另一个具有设备方向的字典
I am trying to use iOS 5 facedetection, and I'm finding that when I run the code on the simulator, it detects a face with correct frame. However, if I run the exact same code on the same image on the device, it returns incorrect dimensions.
Here's my code:
CIImage* image = [CIImage imageWithCGImage:someImage.CGImage];
NSDictionary *detectorOptions =
[NSDictionary dictionaryWithObjectsAndKeys:
CIDetectorAccuracyHigh, CIDetectorAccuracy,
nil];
CIDetector* detector = [CIDetector detectorOfType:CIDetectorTypeFace
context:nil
options:detectorOptions];
NSArray *faceFeatures = [detector featuresInImage:image];
for (CIFeature *f in faceFeatures) {
NSLog(@"Feature: %@", NSStringFromRect(f.bounds));
}
The output from the simulator (correct):
Feature: {{78, 153}, {200, 200}}
The output from the device (incorrect):
Feature: {{104, 199}, {272, 272}}
Is this a bug? Or am I improperly using the face detection code? I've also tried using featuresInImage:options and passing in another dictionary with the device orientation
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论