objc2-core-ml 0.3.2

Bindings to the CoreML framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-image-io")]
use objc2_image_io::*;

use crate::*;

/// Options keys passed into the MLFeatureValue construction for image types
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlfeaturevalueimageoption?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type MLFeatureValueImageOption = NSString;

extern "C" {
    /// Key for CGRect describing a crop region of interest of image source in normalized coordinates
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlfeaturevalueimageoptioncroprect?language=objc)
    pub static MLFeatureValueImageOptionCropRect: &'static MLFeatureValueImageOption;
}

extern "C" {
    /// Key for VNImageCropAndScaleOption describing how to crop and scale the image (or region of interest) to the desired size
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlfeaturevalueimageoptioncropandscale?language=objc)
    pub static MLFeatureValueImageOptionCropAndScale: &'static MLFeatureValueImageOption;
}

/// MLImageConversion.
#[cfg(feature = "MLFeatureValue")]
impl MLFeatureValue {
    extern_methods!(
        /// Construct image feature value from an image on disk. Orientation is read from Exif if avaiable
        ///
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(featureValueWithImageAtURL:pixelsWide:pixelsHigh:pixelFormatType:options:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn featureValueWithImageAtURL_pixelsWide_pixelsHigh_pixelFormatType_options_error(
            url: &NSURL,
            pixels_wide: NSInteger,
            pixels_high: NSInteger,
            pixel_format_type: OSType,
            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        #[cfg(feature = "MLImageConstraint")]
        /// Construct image feature value from an image on disk, using a model specified image constraint. Orientation is read from Exif if avaiable
        ///
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(featureValueWithImageAtURL:constraint:options:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn featureValueWithImageAtURL_constraint_options_error(
            url: &NSURL,
            constraint: &MLImageConstraint,
            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        #[cfg(feature = "objc2-core-graphics")]
        /// Construct image feature value from CGImage (orientation is assumed to be kCGImagePropertyOrientationUp)
        ///
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(featureValueWithCGImage:pixelsWide:pixelsHigh:pixelFormatType:options:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn featureValueWithCGImage_pixelsWide_pixelsHigh_pixelFormatType_options_error(
            cg_image: &CGImage,
            pixels_wide: NSInteger,
            pixels_high: NSInteger,
            pixel_format_type: OSType,
            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        #[cfg(all(feature = "MLImageConstraint", feature = "objc2-core-graphics"))]
        /// Construct image feature value from CGImage, using the size and type information required by feature description (orientation is assumed to be kCGImagePropertyOrientationUp)
        ///
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(featureValueWithCGImage:constraint:options:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn featureValueWithCGImage_constraint_options_error(
            cg_image: &CGImage,
            constraint: &MLImageConstraint,
            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        #[cfg(feature = "objc2-image-io")]
        /// Construct image feature value from an image on disk. The passed in orientation supersedes any in the file
        ///
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(featureValueWithImageAtURL:orientation:pixelsWide:pixelsHigh:pixelFormatType:options:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn featureValueWithImageAtURL_orientation_pixelsWide_pixelsHigh_pixelFormatType_options_error(
            url: &NSURL,
            orientation: CGImagePropertyOrientation,
            pixels_wide: NSInteger,
            pixels_high: NSInteger,
            pixel_format_type: OSType,
            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        #[cfg(all(feature = "MLImageConstraint", feature = "objc2-image-io"))]
        /// Construct image feature value from an image on disk using a model specified image constraint. The passed in orientation supersedes any in the file
        ///
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(featureValueWithImageAtURL:orientation:constraint:options:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn featureValueWithImageAtURL_orientation_constraint_options_error(
            url: &NSURL,
            orientation: CGImagePropertyOrientation,
            constraint: &MLImageConstraint,
            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        #[cfg(all(feature = "objc2-core-graphics", feature = "objc2-image-io"))]
        /// Construct image feature value from CGImage w/ specified orientation
        ///
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(featureValueWithCGImage:orientation:pixelsWide:pixelsHigh:pixelFormatType:options:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn featureValueWithCGImage_orientation_pixelsWide_pixelsHigh_pixelFormatType_options_error(
            cg_image: &CGImage,
            orientation: CGImagePropertyOrientation,
            pixels_wide: NSInteger,
            pixels_high: NSInteger,
            pixel_format_type: OSType,
            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        #[cfg(all(
            feature = "MLImageConstraint",
            feature = "objc2-core-graphics",
            feature = "objc2-image-io"
        ))]
        /// Construct image feature value from CGImage w/ specified orientation, using the size and type information required by feature description
        ///
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(featureValueWithCGImage:orientation:constraint:options:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn featureValueWithCGImage_orientation_constraint_options_error(
            cg_image: &CGImage,
            orientation: CGImagePropertyOrientation,
            constraint: &MLImageConstraint,
            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
        ) -> Result<Retained<Self>, Retained<NSError>>;
    );
}