2
我正在使用CIFeature类参考进行人脸检测,并且我比Core Graphics坐标和常规UIKit坐标有点困惑。这是我的代码:CIFaceFeature的坐标系
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它说:
边界保存发现的功能的矩形。 (只读)
讨论矩形位于图像的坐标系中。
当我直接输出FaceRect时,得到:get rect {{136,427},{46,46}}。当我应用CGAffineTransfer以正确的方式翻转它时,我得到的负坐标看起来不正确。我正在使用的图像是在ImageView中。
那么在哪个坐标系中有这些坐标?图片? ImageView?核心图形坐标?常规坐标?
我有同样的问题所困扰。你能给我完整的代码链接吗?我不明白在哪里使用这种方法,以及如何正确应用脸部的矩形。提前致谢。 –