2016-10-13 115 views
2

我還發現這個問題on Apple Dev ForumCIDetector是否可以返回多個CIDetectorTypeRectangle類型的CIFeature?

設置CIDetectorTypeRectangleCIDetector可能返回多於一個矩形嗎?

目前,即使圖片中有多個矩形,此代碼始終會返回的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

根據該通話在WWDC(http://asciiwwdc.com/2014/sessions/514),它被限制爲僅一個矩形。

下面是一個報價:

因此,我們已經創建了一個通用的矩形檢測對象,它需要一個 選項參數這是我們要搜索的縱橫比。

而且,您可以要求探測器返回特徵數組。

現在,它只是返回一個矩形,但可能會改變未來的 。

+0

是的,這是我明白,當我看到蘋果開發論壇沒有答案...希望未來將很快到達,已經2年了!謝謝喬。 – Tulleb

相關問題