【问题标题】:Can CIDetector returns more than one CIFeature of type CIDetectorTypeRectangle?CIDetector 能否返回多个 CIDetectorTypeRectangle 类型的 CIFeature?
【发布时间】:2016-10-13 22:48:21
【问题描述】:

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

CIDetectorCIDetectorTypeRectangle 的集合是否可以返回多个矩形?

目前,此代码始终返回 01 中的 feature.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

【问题讨论】:

    标签: ios swift core-image cidetector


    【解决方案1】:

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

    这是一个引用:

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

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

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

    【讨论】:

    • 是的,当我在 Apple Dev Forum 上看到没有答案时,我明白了……希望未来能尽快到来,现在已经 2 年了!谢谢乔。
    猜你喜欢
    • 2018-08-20
    • 1970-01-01
    • 2016-07-21
    • 2021-09-21
    • 1970-01-01
    • 2016-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多