【发布时间】:2013-08-08 21:07:32
【问题描述】:
我正在使用 CIFeature 类参考进行人脸检测,但我对 Core Graphics 坐标和常规 UIKit 坐标有点困惑。这是我的代码:
UIImage *mainImage = [UIImage imageNamed:@"facedetectionpic.jpg"];
CIImage *image = [[CIImage alloc] initWithImage:mainImage];
NSDictionary *options = [NSDictionary dictionaryWithObject:CIDetectorAccuracyHigh forKey:CIDetectorAccuracy];
CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:options];
NSArray *features = [detector featuresInImage:image];
CGRect faceRect;
for (CIFaceFeature *feature in features)
{
faceRect= [feature bounds];
}
这很标准。现在根据官方documentation 说:
bounds 包含已发现特征的矩形。 (只读)
讨论矩形在图像的坐标系中。
当我直接输出 FaceRect 时,我得到:get rect {{136, 427}, {46, 46}}。当我应用 CGAffineTransfer 以正确的方式翻转它时,我得到看起来不正确的负坐标。我正在使用的图像位于 ImageView 中。
那么这些坐标在哪个坐标系中呢?图片?图像视图?核心图形坐标?正则坐标?
【问题讨论】:
标签: iphone ios face-detection