vImageCVImageFormat_GetChannelNames(_:)
Returns the names of the channels of a Core Video image format.
Declaration
func vImageCVImageFormat_GetChannelNames(_ format: vImageConstCVImageFormat) -> UnsafePointer<vImageBufferTypeCode>!Parameters
- format:
The Core Video image format to query.
Return Value
A pointer to an array that contains the vImageBufferTypeCode elements that correspond to the names of the channels in the image.
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_GetChannelNames(_:):
let channelNames = withUnsafeBytes(of: cvImageFormat) { bytes in
let format = bytes.assumingMemoryBound(
to: vImageConstCVImageFormat.self).first!
return vImageCVImageFormat_GetChannelNames(format)
}