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
9use crate::*;
10
11/// Options keys passed into the MLFeatureValue construction for image types
12///
13/// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlfeaturevalueimageoption?language=objc)
14// NS_TYPED_EXTENSIBLE_ENUM
15pub type MLFeatureValueImageOption = NSString;
16
17extern "C" {
18    /// Key for CGRect describing a crop region of interest of image source in normalized coordinates
19    ///
20    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlfeaturevalueimageoptioncroprect?language=objc)
21    pub static MLFeatureValueImageOptionCropRect: &'static MLFeatureValueImageOption;
22}
23
24extern "C" {
25    /// Key for VNImageCropAndScaleOption describing how to crop and scale the image (or region of interest) to the desired size
26    ///
27    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlfeaturevalueimageoptioncropandscale?language=objc)
28    pub static MLFeatureValueImageOptionCropAndScale: &'static MLFeatureValueImageOption;
29}
30
31/// MLImageConversion.
32#[cfg(feature = "MLFeatureValue")]
33impl MLFeatureValue {
34    extern_methods!(
35        /// Construct image feature value from an image on disk. Orientation is read from Exif if avaiable
36        #[unsafe(method(featureValueWithImageAtURL:pixelsWide:pixelsHigh:pixelFormatType:options:error:_))]
37        #[unsafe(method_family = none)]
38        pub unsafe fn featureValueWithImageAtURL_pixelsWide_pixelsHigh_pixelFormatType_options_error(
39            url: &NSURL,
40            pixels_wide: NSInteger,
41            pixels_high: NSInteger,
42            pixel_format_type: OSType,
43            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
44        ) -> Result<Retained<Self>, Retained<NSError>>;
45
46        #[cfg(feature = "MLImageConstraint")]
47        /// Construct image feature value from an image on disk, using a model specified image constraint. Orientation is read from Exif if avaiable
48        #[unsafe(method(featureValueWithImageAtURL:constraint:options:error:_))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn featureValueWithImageAtURL_constraint_options_error(
51            url: &NSURL,
52            constraint: &MLImageConstraint,
53            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
54        ) -> Result<Retained<Self>, Retained<NSError>>;
55
56        #[cfg(feature = "objc2-core-graphics")]
57        /// Construct image feature value from CGImage (orientation is assumed to be kCGImagePropertyOrientationUp)
58        #[unsafe(method(featureValueWithCGImage:pixelsWide:pixelsHigh:pixelFormatType:options:error:_))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn featureValueWithCGImage_pixelsWide_pixelsHigh_pixelFormatType_options_error(
61            cg_image: &CGImage,
62            pixels_wide: NSInteger,
63            pixels_high: NSInteger,
64            pixel_format_type: OSType,
65            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
66        ) -> Result<Retained<Self>, Retained<NSError>>;
67
68        #[cfg(all(feature = "MLImageConstraint", feature = "objc2-core-graphics"))]
69        /// Construct image feature value from CGImage, using the size and type information required by feature description (orientation is assumed to be kCGImagePropertyOrientationUp)
70        #[unsafe(method(featureValueWithCGImage:constraint:options:error:_))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn featureValueWithCGImage_constraint_options_error(
73            cg_image: &CGImage,
74            constraint: &MLImageConstraint,
75            options: Option<&NSDictionary<MLFeatureValueImageOption, AnyObject>>,
76        ) -> Result<Retained<Self>, Retained<NSError>>;
77    );
78}