-2

https://developer.apple.com/library/ios/documentation/graphicsimaging/Conceptual/CoreImaging/ci_detect_faces/ci_detect_faces.html

@ 清单 2-1 创建人脸检测器

CIContext *context = [CIContext contextWithOptions:nil];                    // 1
NSDictionary *opts = @{ CIDetectorAccuracy : CIDetectorAccuracyHigh };      // 2
CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeFace
                                      context:context
                                      options:opts];                    // 3

opts = @{ CIDetectorImageOrientation :
      [[myImage properties] valueForKey:kCGImagePropertyOrientation] }; // 4
NSArray *features = [detector featuresInImage:myImage options:opts];        // 5

4.建立一个选项字典来寻找面孔。让 Core Image 知道图像方向很重要,这样检测器才能知道在哪里可以找到直立的面孔。大多数时候,您将从图像本身读取图像方向,然后将该值提供给选项字典。

Use of undeclared identifier 'kCGImagePropertyOrientation'

这个图像道具的方向应该是什么?
什么样的对象?
我该如何设置?

4

1 回答 1

6

您需要将ImageIO框架包含到您的项目中。

kCGImagePropertyOrientation

图像的预期显示方向。如果存在,此键是一个 CFNumber 值,其值与 TIFF 和 EXIF 规范定义的值相同。该值指定图像的原点 (0,0) 所在的位置,如表 1 所示。如果不存在,则假定值为 1。

于 2014-03-22T13:06:07.973 回答