Class

MLImageConstraint

The width, height, and pixel format constraints of an image feature.

Declaration

@interface MLImageConstraint : NSObject

Overview

In CoreML, an image is a collection of pixels represented by CVPixelBuffer. An image feature is a model input or output that accepts or produces, respectively, an image bundled in an MLFeatureValue. MLImageConstraint defines the image feature's limitations for the images within an MLFeatureValue.

If a model has an image feature, for input or output, the model author can use an image feature description to inform the developer about the constraints of the image feature. An image feature description is an instance of MLFeatureDescription with:

Topics

Accessing the Constraints

pixelsWide

The model's default width for an image feature.

pixelsHigh

The model's default height for an image feature.

pixelFormatType

The model's pixel format for an image feature.

Inspecting Acceptable Sizes

sizeConstraint

Additional sizes this image feature supports.

MLImageSizeConstraint

A list or range of sizes that augment an image constraint's default size.

Relationships

Inherits From

Conforms To

See Also

Creating Image Feature Values

+ featureValueWithCGImage:pixelsWide:pixelsHigh:pixelFormatType:options:error:

Wraps an image as a value for a feature, given an image, its width, and its height, in pixels.

+ featureValueWithCGImage:constraint:options:error:

Wraps an image as a value for a feature, given an image and its constraints.

+ featureValueWithImageAtURL:pixelsWide:pixelsHigh:pixelFormatType:options:error:

Wraps an image as a value for a feature, given an image’s URL, and its width and height, in pixels.

+ featureValueWithImageAtURL:constraint:options:error:

Wraps an image as a value for a feature, given an image’s URL and constraints.

MLFeatureValueImageOption

The initializer options to crop and scale an image when you create an image feature value.