Contents

vImageCVImageFormat_GetChannelDescription(_:_:)

Returns the channel description for a particular channel type.

Declaration

func vImageCVImageFormat_GetChannelDescription(_ format: vImageConstCVImageFormat, _ type: vImageBufferTypeCode) -> UnsafePointer<vImageChannelDescription>!

Parameters

Return Value

A pointer to a vImageChannelDescription structure that contains the channel description.

Discussion

The functions that create Core Video image formats, such as vImageCVImageFormat_CreateWithCVPixelBuffer(_:), return a vImageCVImageFormat. The following code shows how you create a vImageConstCVImageFormat representation of a vImageCVImageFormat instance to pass to vImageCVImageFormat_GetChannelDescription(_:_:):

let channelDescription = withUnsafeBytes(of: cvImageFormat) { bytes in
    let format = bytes.assumingMemoryBound(
        to: vImageConstCVImageFormat.self).first!
    
    return vImageCVImageFormat_GetChannelDescription(format,
                                                     vImageBufferTypeCode(kvImageBufferTypeCode_Luminance))
}

See Also

Related Documentation

Querying and setting channel information