I have CVPixelBuffer
that has kCVPixelFormatType_32ARGB
format. I need to extract each channel and store it to separate CVPixelBuffer
. I imagine the usage of it like this
let channels: [CVPixelBuffer] = pixBuffer.split()
So this, for the time being, imaginary function will output 4 CVPixelBuffers of kCVPixelFormatType_OneComponent8
format.
My question is - is there a fast, convenient and iOS-compliant way to do it? I know how to do it via OpenCV, but my code is in Swift
and I will need to write complex and not pretty code bouncing CVPixelBuffer
between Swift
and Objective-C
.
I feel that the answer should lie somewhere around Accelerate
framework. And if I am right, I am pretty sure there is a person who will guide me through it :)