I am using AVCaptureSession
& AVCapturePhotoOutput
to capture RAW photo data from device's camera in the kCVPixelFormatType_14Bayer_RGGB
format.
I have got as far as getting the raw photo sample buffer in the AVCapturePhotoCaptureDelegate
callback:
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 }
}
I am now attempting to follow the answers to this question to obtain pixel values from the CVPixelBufferRef
but I cannot work out how to do this when using the 14 bit Bayer RGGB pixel format as opposed to the 32 bit RGB format mentioned in the answers.