iOS人脸检测在模拟器和设备中的工作方式不同

时间:2012-02-17 20:31:27

标签: ios face-detection core-image

我正在尝试使用iOS 5 facedetection,我发现当我在模拟器上运行代码时,它会检测到具有正确帧的面部。但是,如果我在设备上的同一图像上运行完全相同的代码,则会返回不正确的尺寸。 这是我的代码:

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并传入另一个带有设备方向的字典

0 个答案:

没有答案