0

私は最終的に、顔を検出してカメラで笑顔を浮かべるようにGoogle Mobile Vision sdkを使用することにしました。サンプルバッファーからUIImageを取得したときにGoogle Visionがクラッシュする

私のプロジェクトにサンプルコードを貼り付けた後、それは常にcaptureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection)コールバックでクラッシュします。 BAD_ACCESS例外を常にスローするコードスナップを示します。

func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) { 
    if (faceDetector == nil) { 
     self.faceDetector = GMVDetector(ofType: GMVDetectorTypeFace, options: [GMVDetectorFaceLandmarkType: GMVDetectorFaceLandmark.all.rawValue, 
                       GMVDetectorFaceClassificationType: GMVDetectorFaceClassification.all.rawValue, 
                       GMVDetectorFaceMinSize: 0.3, 
                       GMVDetectorFaceTrackingEnabled: true]) 
    } 
    guard let image = GMVUtility.sampleBufferTo32RGBA(sampleBuffer) else { // <-- this is where throws exception 
     print("Invalid sample buffer") 
     return 
    } 
} 

可能な重複Google Face Detection crashing when converting to image and trying to detect faceそれへの正しい答えはありません。

ありがとうございます。

答えて

0

最後に、AVCaptureSessionのsessionPressetをAVCaptureSessionPresetMediumに設定しました。

self.session.sessionPreset = .medium 

明らかに、ライブラリにメモリリークがあります。

関連する問題