Contents

planarBuffers()

Returns four unsigned 16-bit planar pixel buffers that contain the deinterleaved channels of the buffer.

Declaration

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

Return Value

An array of planar pixel buffers.

Discussion

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.Interleaved16Ux4 pixel buffer:

let src = vImage.PixelBuffer<vImage.Interleaved16Ux4>(
    pixelValues: [100, 200, 300, 400] as [UInt16],
    size: vImage.Size(width: 1, height: 1))

let planarBuffers = src.planarBuffers()

// Prints "[100] [200] [300] [400]"
for planarBuffer in planarBuffers {
    print(planarBuffer.array)
}

See Also

Generating planar buffers from interleaved buffers