objc2_core_ml/generated/
MLFeatureValue_MLImageConversion.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-graphics")]
6use objc2_core_graphics::*;
7use objc2_foundation::*;
8#[cfg(feature = "objc2-image-io")]
9use objc2_image_io::*;
10
11use crate::*;
12
13/// Options keys passed into the MLFeatureValue construction for image types
14///
15/// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlfeaturevalueimageoption?language=objc)
16// NS_TYPED_EXTENSIBLE_ENUM
17pub type MLFeatureValueImageOption = NSString;
18
19extern "C" {
20    /// Key for CGRect describing a crop region of interest of image source in normalized coordinates
21    ///
22    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlfeaturevalueimageoptioncroprect?language=objc)
23    pub static MLFeatureValueImageOptionCropRect: &'static MLFeatureValueImageOption;
24}
25
26extern "C" {
27    /// Key for VNImageCropAndScaleOption describing how to crop and scale the image (or region of interest) to the desired size
28    ///
29    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlfeaturevalueimageoptioncropandscale?language=objc)
30    pub static MLFeatureValueImageOptionCropAndScale: &'static MLFeatureValueImageOption;
31}
32
33/// MLImageConversion.
34#[cfg(feature = "MLFeatureValue")]
35impl MLFeatureValue {
36    extern_methods!(
37        /// Construct image feature value from an image on disk. Orientation is read from Exif if avaiable
38        ///
39        /// # Safety
40        ///
41        /// `options` generic should be of the correct type.
42        #[unsafe(method(featureValueWithImageAtURL:pixelsWide:pixelsHigh:pixelFormatType:options:error:_))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn featureValueWithImageAtURL_pixelsWide_pixelsHigh_pixelFormatType_options_error(
45            url: &NSURL,
46            pixels_wide: NSInteger,
47            pixels_high: NSInteger,
48            pixel_format_type: OSType,
49            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
50        ) -> Result<Retained<Self>, Retained<NSError>>;
51
52        #[cfg(feature = "MLImageConstraint")]
53        /// Construct image feature value from an image on disk, using a model specified image constraint. Orientation is read from Exif if avaiable
54        ///
55        /// # Safety
56        ///
57        /// `options` generic should be of the correct type.
58        #[unsafe(method(featureValueWithImageAtURL:constraint:options:error:_))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn featureValueWithImageAtURL_constraint_options_error(
61            url: &NSURL,
62            constraint: &MLImageConstraint,
63            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
64        ) -> Result<Retained<Self>, Retained<NSError>>;
65
66        #[cfg(feature = "objc2-core-graphics")]
67        /// Construct image feature value from CGImage (orientation is assumed to be kCGImagePropertyOrientationUp)
68        ///
69        /// # Safety
70        ///
71        /// `options` generic should be of the correct type.
72        #[unsafe(method(featureValueWithCGImage:pixelsWide:pixelsHigh:pixelFormatType:options:error:_))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn featureValueWithCGImage_pixelsWide_pixelsHigh_pixelFormatType_options_error(
75            cg_image: &CGImage,
76            pixels_wide: NSInteger,
77            pixels_high: NSInteger,
78            pixel_format_type: OSType,
79            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
80        ) -> Result<Retained<Self>, Retained<NSError>>;
81
82        #[cfg(all(feature = "MLImageConstraint", feature = "objc2-core-graphics"))]
83        /// Construct image feature value from CGImage, using the size and type information required by feature description (orientation is assumed to be kCGImagePropertyOrientationUp)
84        ///
85        /// # Safety
86        ///
87        /// `options` generic should be of the correct type.
88        #[unsafe(method(featureValueWithCGImage:constraint:options:error:_))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn featureValueWithCGImage_constraint_options_error(
91            cg_image: &CGImage,
92            constraint: &MLImageConstraint,
93            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
94        ) -> Result<Retained<Self>, Retained<NSError>>;
95
96        #[cfg(feature = "objc2-image-io")]
97        /// Construct image feature value from an image on disk. The passed in orientation supersedes any in the file
98        ///
99        /// # Safety
100        ///
101        /// `options` generic should be of the correct type.
102        #[unsafe(method(featureValueWithImageAtURL:orientation:pixelsWide:pixelsHigh:pixelFormatType:options:error:_))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn featureValueWithImageAtURL_orientation_pixelsWide_pixelsHigh_pixelFormatType_options_error(
105            url: &NSURL,
106            orientation: CGImagePropertyOrientation,
107            pixels_wide: NSInteger,
108            pixels_high: NSInteger,
109            pixel_format_type: OSType,
110            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
111        ) -> Result<Retained<Self>, Retained<NSError>>;
112
113        #[cfg(all(feature = "MLImageConstraint", feature = "objc2-image-io"))]
114        /// Construct image feature value from an image on disk using a model specified image constraint. The passed in orientation supersedes any in the file
115        ///
116        /// # Safety
117        ///
118        /// `options` generic should be of the correct type.
119        #[unsafe(method(featureValueWithImageAtURL:orientation:constraint:options:error:_))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn featureValueWithImageAtURL_orientation_constraint_options_error(
122            url: &NSURL,
123            orientation: CGImagePropertyOrientation,
124            constraint: &MLImageConstraint,
125            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
126        ) -> Result<Retained<Self>, Retained<NSError>>;
127
128        #[cfg(all(feature = "objc2-core-graphics", feature = "objc2-image-io"))]
129        /// Construct image feature value from CGImage w/ specified orientation
130        ///
131        /// # Safety
132        ///
133        /// `options` generic should be of the correct type.
134        #[unsafe(method(featureValueWithCGImage:orientation:pixelsWide:pixelsHigh:pixelFormatType:options:error:_))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn featureValueWithCGImage_orientation_pixelsWide_pixelsHigh_pixelFormatType_options_error(
137            cg_image: &CGImage,
138            orientation: CGImagePropertyOrientation,
139            pixels_wide: NSInteger,
140            pixels_high: NSInteger,
141            pixel_format_type: OSType,
142            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
143        ) -> Result<Retained<Self>, Retained<NSError>>;
144
145        #[cfg(all(
146            feature = "MLImageConstraint",
147            feature = "objc2-core-graphics",
148            feature = "objc2-image-io"
149        ))]
150        /// Construct image feature value from CGImage w/ specified orientation, using the size and type information required by feature description
151        ///
152        /// # Safety
153        ///
154        /// `options` generic should be of the correct type.
155        #[unsafe(method(featureValueWithCGImage:orientation:constraint:options:error:_))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn featureValueWithCGImage_orientation_constraint_options_error(
158            cg_image: &CGImage,
159            orientation: CGImagePropertyOrientation,
160            constraint: &MLImageConstraint,
161            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
162        ) -> Result<Retained<Self>, Retained<NSError>>;
163    );
164}