我们正在使用CIRectFeature
通过摄像机委托(AVCaptureVideoDataOutputSampleBufferDelegate
)检测矩形区域,并且可以与iPad Pro
第三代以外的其他设备正常工作。由于CIRectangleFeature
应用程序每次都挂起并在错误以下返回的原因
由于执行期间发生错误,命令缓冲区的执行被中止 执行。丢弃(GPU错误/恢复的受害者)(IOAF代码5)
fileprivate let rectangleDetector = CIDetector(ofType: CIDetectorTypeRectangle, context: nil, options: [CIDetectorAccuracy:CIDetectorAccuracyHigh])
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection)
{
guard let pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else {
return
}
let videoOutputImage = CIImage.init(cvPixelBuffer: pixelBuffer)
guard let rectangeFeatures = self.rectangleDetector?.features(in: videoOutputImage) as? [CIRectangleFeature] else {
return
}
}