0
我使用Vision檢測文本並且它工作正常當檢測到某些東西並調用某個功能時,但它仍在使用完成,但文本仍在檢測中。停止檢測Apple Vision,iOS,Swift中的字母
如何停止的文本檢測
要啓動它,我使用:
func startTextDetection() {
let textRequest = VNDetectTextRectanglesRequest(completionHandler: self.detectTextHandler)
textRequest.reportCharacterBoxes = true
self.requests = [textRequest]
}
// I tried this to stop it but it only hides the boxes around the text.
//func stopTextDetection() {
// let textRequest = VNDetectTextRectanglesRequest(completionHandler: //self.detectTextHandler)
// textRequest.reportCharacterBoxes = false
// self.requests = [textRequest]
//}
func detectTextHandler(request: VNRequest, error: Error?) {
guard let observations = request.results else {
print("no result")
return
}
「stop」是什麼意思?該請求將一直運行,直到完成對資產(圖像,視頻等)的分析。你不能暫停/恢復它的進度。 – nathan
當檢測到文本時,會出現啓動文本檢測,我稱之爲函數我希望文本檢測在調用此函數的同時停止運行。我不想暫停它,我希望它停止完全檢測 –
幾個問題。首先,我們是在說一個單一的圖像或其他東西的來源?其次,「停止」文本檢測的目標是什麼?像@nathan一樣,我很困惑。如果您拍攝*單張*圖片並使用視覺*檢測*中的文字,則顯然是「全部或全部」。你所做的* *取決於你。我感覺到這個問題是我們不明白的。 – dfd