【发布时间】:2013-07-16 23:45:39
【问题描述】:
我正在尝试将人脸检测添加到我的应用程序中,而我添加的代码返回了一个与人脸无关的 CGRect。
这是代码
CIImage *cIImage = [CIImage imageWithCGImage:self.imageView.image.CGImage];
CIDetector* faceDetector = [CIDetector detectorOfType:CIDetectorTypeFace
context:nil options:[NSDictionary
dictionaryWithObject:CIDetectorAccuracyHigh forKey:CIDetectorAccuracy]];
NSArray *features = [faceDetector featuresInImage:cIImage];
for(CIFaceFeature* faceObject in features)
{
FaceLocation.x = faceObject.bounds.origin.x;
FaceLocation.y = faceObject.bounds.origin.y;
}// Here face location is far off away form the actual face
但是这段代码给了我一个远离真实面孔的位置,我在这里做错了什么?
【问题讨论】:
-
边界的大小如何?你为什么不看完整的界限?当然,原点将在角落里。这就是为什么它被称为原点而不是中心
标签: ios face-detection core-image