I use AVCaptureSession & AVCapturePhotoOutput to capture RAW photos from a device’s camera in kCVPixelFormatType_14Bayer_RGGB format.
I got to the raw photo buffer in the AVCapturePhotoCaptureDelegate :
func capture(captureOutput: AVCapturePhotoOutput, didFinishProcessingRawPhotoSampleBuffer rawSampleBuffer: CMSampleBuffer?, previewPhotoSampleBuffer: CMSampleBuffer?, resolvedSettings: AVCaptureResolvedPhotoSettings, bracketSettings: AVCaptureBracketedStillImageSettings?, error: Error?) { guard let rawSampleBuffer = rawSampleBuffer else { return } guard let pixelBuffer = CMSampleBufferGetImageBuffer(rawSampleBuffer) else { return } }
Now I am trying to follow the answers to this question in order to get pixel values from CVPixelBufferRef , but I can’t figure out how to do this when using the Bayer RGGB 14-bit pixel format, unlike the 32-bit RGB format mentioned in the answers.
source share