init(pixelBuffer:)
Creates a feature value that contains an image from a pixel buffer.
Declaration
convenience init(pixelBuffer value: CVPixelBuffer)Parameters
- value:
A Cvpixelbuffer Q2e (Swift) or Cvpixelbuffer (Objective-C) instance.
Discussion
Core ML supports different pixel format types depending on the model’s feature description. For information about ImageFeatureType, see Core ML Format Reference. When the image feature’s color space is GRAYSCALE, use kCVPixelFormatType_OneComponent8; and when it’s GRAYSCALE_FLOAT16, use kCVPixelFormatType_OneComponent16Half; otherwise, use kCVPixelFormatType_32BGRA when it’s set to RGB or BGR.
See Also
Creating image feature values
init(CGImage:pixelsWide:pixelsHigh:pixelFormatType:options:)init(CGImage:orientation:pixelsWide:pixelsHigh:pixelFormatType:options:)init(CGImage:constraint:options:)init(CGImage:orientation:constraint:options:)init(imageAtURL:pixelsWide:pixelsHigh:pixelFormatType:options:)init(imageAtURL:orientation:pixelsWide:pixelsHigh:pixelFormatType:options:)init(imageAtURL:constraint:options:)init(imageAtURL:orientation:constraint:options:)MLImageConstraintMLFeatureValue.ImageOption