Contents

planarBuffers()

Returns two 32-bit planar pixel buffers that contain the deinterleaved channels of the buffer.

Declaration

func planarBuffers() -> [vImage.PixelBuffer<vImage.PlanarF>]

Return Value

An array of planar pixel buffers.

Discussion

Use this function to deinterleave a buffer and create two new planar buffers that contain copies of each source channel. For example, the following code generates two 1 x 1 planar buffers from an vImage.InterleavedFx2 pixel buffer:

let src = vImage.PixelBuffer<vImage.InterleavedFx2>(
    pixelValues: [0.125, 0.25, 0.5, 1] as [Float],
    size: vImage.Size(width: 2, height: 1))

let planarBuffers = src.planarBuffers()

// Prints "[0.125, 0.5] [0.25, 1.0]"
for planarBuffer in planarBuffers {
    print(planarBuffer.array)
}

See Also

Generating planar buffers from interleaved buffers