1

VNImageRequestHandler我们必须通过CVImageBuffer

这基本上是AVCaptureVideoDataOutput具有特定视频设置的输出。

    override func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {N
.........
       let imageRequestHandler = VNImageRequestHandler(cvPixelBuffer: pixelBuffer, orientation: exifOrientation, options: [:])
......
}

问题1:必须是kCVPixelFormatType_420YpCbCr8BiPlanarFullRange还是可以kCVPixelFormatType_32BGRA

        videoDataOutput.videoSettings = [kCVPixelBufferPixelFormatTypeKey as String: Int(kCVPixelFormatType_420YpCbCr8BiPlanarFullRange)]

问题 2:如果它允许 32BGRA,那么何时使用kCVPixelFormatType_32BGRA以及如何VNImageRequestHandler区分 YCBCR 和 32BGRA 以实现最佳和高效的图像识别?

4

0 回答 0