planarBuffers()
Returns four 32-bit planar pixel buffers that contain the deinterleaved channels of the 8-bit buffer.
Declaration
func planarBuffers() -> [vImage.PixelBuffer<vImage.PlanarF>]Return Value
An array of planar pixel buffers.
Discussion
This function treats 32-bit floating point pixels represented by the range 0 ... 1 as the Pixel_8 range `0 … 255`.
Use this function to deinterleave a buffer and create four new planar buffers that contain copies of each source channel. For example, the following code generates four 1 x 1 planar buffers from an vImage.Interleaved8x4 pixel buffer:
let src = vImage.PixelBuffer<vImage.Interleaved8x4>(
pixelValues: [255 / 17, 255 / 15, 255 / 5, 255 / 3] as [UInt8],
size: vImage.Size(width: 1, height: 1))
let planarBuffers: [vImage.PixelBuffer<vImage.PlanarF>] = src.planarBuffers()
// Prints "[0.058823533] [0.06666667] [0.20000002] [0.33333334]"
// ≅ [ 1 / 17, 1 / 15, 1 / 5, 1 / 3]
for planarBuffer in planarBuffers {
print(planarBuffer.array)
}