ios - CIDetector 能否返回多个 CIDetectorTypeRectangle 类型的 CIFeature?

标签 ios swift core-image cidetector

我也发现了这个问题on Apple Dev Forum .

设置为 CIDetectorTypeRectangleCIDetector 是否有可能返回不止一个矩形?

目前,此代码始终返回 01feature.count,即使图片中充满了矩形。

let context = CIContext()
let opts = [CIDetectorAccuracy : CIDetectorAccuracyHigh]
let detector = CIDetector(ofType: CIDetectorTypeRectangle, context: context, options: opts)
let image = CIImage(image: self.photoTaken)
let features = detector.features(in: image)

print(features.count) // never more than 1

最佳答案

根据 WWDC(http://asciiwwdc.com/2014/sessions/514)中的这个演讲,它仅限于一个矩形。

引用一段话:

So we've created a generic rectangle detector object and it takes one option parameter which is the aspect ratio that we want to search for.

And again, you can ask the detector to return the features array.

Now right now, it just returns one rectangle but that may change in the future.

关于ios - CIDetector 能否返回多个 CIDetectorTypeRectangle 类型的 CIFeature?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40021560/

相关文章:

opengl-es - 核心图像 : EAGLContext framebuffer or renderbuffer incorrectly configured

objective-c - Objective C 提高 CIImage 过滤速度

objective-c - 使用 CIImage 使所有黑色像素透明

iphone - 如何在ios6中创建多页PDF?

ios - ipa大小和项目大小之间的巨大差异

ios - 无法正确检测多几何形状的碰撞

arrays - 使用 Swift 查找数组中的重复元素

objective-c - 如何使用 iOS 5 中的 Twitter 框架获取用户的 Twitter 个人资料信息?

ios - OCMock 类方法不起作用

ios - 滚动uitableview时重复的单元格