vImageCVImageFormat_GetChannelDescription(_:_:)
Returns the channel description for a particular channel type.
Declaration
func vImageCVImageFormat_GetChannelDescription(_ format: vImageConstCVImageFormat, _ type: vImageBufferTypeCode) -> UnsafePointer<vImageChannelDescription>!Parameters
- format:
The Core Video image format to query.
- type:
The type of the channel that you want information about. For example, Kvimagebuffertypecode_luminance.
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))
}