2

我还在Apple Dev Forum 上找到了这个问题。

CIDetector组 with是否CIDetectorTypeRectangle可以返回多个矩形?

目前,此代码总是返回一个feature.countor 01即使图片中充满了矩形。

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
4

1 回答 1

4

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

这是一个报价:

所以我们创建了一个通用的矩形检测器对象,它需要一个选项参数,即我们要搜索的纵横比。

同样,您可以要求检测器返回特征数组。

现在,它只返回一个矩形,但将来可能会改变。

于 2016-10-13T14:06:04.440 回答