channelCount
The number of channels, including alpha, for the Core Video image format.
Declaration
var channelCount: UInt32 { get }Discussion
For example, the following code prints the number of channels in a kCVPixelFormatType_420YpCbCr8Planar Core Video image format:
let cvImageFormat = vImageCVImageFormat.make(
format: .format420YpCbCr8Planar,
matrix: kvImage_ARGBToYpCbCrMatrix_ITU_R_709_2.pointee,
chromaSiting: .center,
colorSpace: CGColorSpace(name: CGColorSpace.sRGB)!,
alphaIsOpaqueHint: true)!
// Prints "channelCount: 3".
print("channelCount: \(cvImageFormat.channelCount)")