2017-05-09 86 views
1

有沒有什麼辦法可以提高captureStillImageAsynchronouslyFromConnection的速度?提高捕捉速度StillSiellImageAsynchronouslyFromConnection

我試着只關注輸出幀,如下所示:captureOutput:didOutputSampleBuffer:fromConnection:,但這並不能真正解決問題。此外,我無法像上述captureAsync方法那樣從該授權方法獲得相同的解決方案。

所以我的問題是,有沒有什麼辦法可以提高captureAsync的返回速度?現在我在iPhone 7上平均每個約0.5秒。

也許禁用HDR等?如果有人有任何意見,我會永遠感激。

回答

1

正如你可能已經知道,captureStillImageAsynchronouslyFromConnection:completionHandler: 從iOS的10

不贊成每蘋果文檔

的AVCaptureStillImageOutput類在iOS的10.0棄用,並 不支持較新的相機拍攝功能,作爲RAW圖像輸出, 實況照片,或廣色域的顏色。在iOS 10.0和更高版本中,請改用 AVCapturePhotoOutput類。 (該AVCaptureStillImageOutput 類仍然在MacOS上10.12的支持。)

既然你是針對iPhone 7我建議使用AVCapturePhotoOutput及其委託AVCapturePhotoCaptureDelegate

欲瞭解更多信息chceck了我以前的SO answer

爲了提高速度,AFAIK的唯一方法是使用captureOutput:didOutputSampleBuffer:fromConnection:

  • 它給你t他由Capture Device處理的幀。
  • 爲確保您獲得高質量的圖片,您需要添加正確的AVCapturePhotoSettings並獲得高質量的圖像數據。

從我的測試結果處理速度這種方法可以處理每秒然後20幀爲iPhone 6和每秒超過50幀上iPhone 7,7加上(注意它可能是不準確的結果作爲我的照片設置和圖像處理可能與您的不同)

+0

'captureOutput:didOutputSampleBuffer:fromConnection:'似乎是唯一的選擇。謝謝@Bluewings – COOKIES