【问题标题】:What is kCGImagePropertyOrientation for face detection?什么是用于人脸检测的 kCGImagePropertyOrientation?
【发布时间】:2014-04-29 22:55:21
【问题描述】:

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'

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

【问题讨论】:

标签: ios objective-c face-detection ciimage


【解决方案1】:

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

kCGImagePropertyOrientation:

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

【讨论】:

  • 看来这已经不足以消除错误了。
猜你喜欢
  • 2019-11-18
  • 2018-03-16
  • 2020-05-14
  • 2013-09-24
  • 2017-08-29
  • 2012-04-17
  • 2019-12-01
  • 2017-06-06
  • 1970-01-01
相关资源
最近更新 更多