objc2_core_image/generated/
CIFeature.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// The abstract superclass for objects representing notable features detected in an image.
14    ///
15    /// > Note: In macOS 10.13, iOS 11, and tvOS 11 or later, the Vision framework replaces these classes
16    /// for identifying and analyzing image features.
17    /// See
18    /// <doc
19    /// ://com.apple.documentation/documentation/vision/vnobservation>)
20    ///
21    /// A `CIFeature` object represents a portion of an image that a detector believes matches its criteria.
22    /// Subclasses of CIFeature holds additional information specific to the detector that discovered the feature.
23    ///
24    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/cifeature?language=objc)
25    #[unsafe(super(NSObject))]
26    #[derive(Debug, PartialEq, Eq, Hash)]
27    pub struct CIFeature;
28);
29
30extern_conformance!(
31    unsafe impl NSObjectProtocol for CIFeature {}
32);
33
34impl CIFeature {
35    extern_methods!(
36        /// The type of feature that was discovered.
37        ///
38        /// The type can be one of:
39        /// * ``CIFeatureTypeFace``
40        /// * ``CIFeatureTypeRectangle``
41        /// * ``CIFeatureTypeQRCode``
42        /// * ``CIFeatureTypeText``
43        #[unsafe(method(type))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn r#type(&self) -> Retained<NSString>;
46
47        #[cfg(feature = "objc2-core-foundation")]
48        /// The rectangle that bounds the location of discovered feature.
49        ///
50        /// The rectangle is in the cartesian coordinate system of the image.
51        #[unsafe(method(bounds))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn bounds(&self) -> CGRect;
54    );
55}
56
57/// Methods declared on superclass `NSObject`.
58impl CIFeature {
59    extern_methods!(
60        #[unsafe(method(init))]
61        #[unsafe(method_family = init)]
62        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
63
64        #[unsafe(method(new))]
65        #[unsafe(method_family = new)]
66        pub unsafe fn new() -> Retained<Self>;
67    );
68}
69
70extern "C" {
71    /// A Core Image feature type for person’s face.
72    ///
73    /// To detect faces in an image or video, pass this to ``/CIDetector/detectorOfType:context:options:``
74    ///
75    /// Use the ``CIFaceFeature`` class to find more information about the detected face.
76    ///
77    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/cifeaturetypeface?language=objc)
78    pub static CIFeatureTypeFace: &'static NSString;
79}
80
81extern "C" {
82    /// A Core Image feature type for rectangular object.
83    ///
84    /// To detect rectangles in an image or video, pass this to ``/CIDetector/detectorOfType:context:options:``
85    ///
86    /// Use the ``CIRectangleFeature`` class to find more information about the detected rectangle.
87    ///
88    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/cifeaturetyperectangle?language=objc)
89    pub static CIFeatureTypeRectangle: &'static NSString;
90}
91
92extern "C" {
93    /// A Core Image feature type for QR code object.
94    ///
95    /// To detect QR codes in an image or video, pass this to ``/CIDetector/detectorOfType:context:options:``
96    ///
97    /// Use the ``CIQRCodeFeature`` class to find more information about the detected QR code.
98    ///
99    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/cifeaturetypeqrcode?language=objc)
100    pub static CIFeatureTypeQRCode: &'static NSString;
101}
102
103extern "C" {
104    /// A Core Image feature type for text.
105    ///
106    /// To detect text in an image or video, pass this to ``/CIDetector/detectorOfType:context:options:``
107    ///
108    /// Use the ``CITextFeature`` class to find more information about the detected text.
109    ///
110    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/cifeaturetypetext?language=objc)
111    pub static CIFeatureTypeText: &'static NSString;
112}
113
114extern_class!(
115    /// Information about a face detected in a still or video image.
116    ///
117    /// > Note: In macOS 10.13, iOS 11, and tvOS 11 or later, the Vision framework replaces this
118    /// class for identifying and analyzing image features. See `VNDetectFaceRectanglesRequest`.
119    /// See
120    /// <doc
121    /// ://com.apple.documentation/documentation/vision/vndetectfacerectanglesrequest>)
122    ///
123    /// The properties of a `CIFaceFeature` object provide information about the face’s eyes and mouth.
124    /// A face object in a video can also have properties that track its location over time, tracking ID and frame count.
125    ///
126    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/cifacefeature?language=objc)
127    #[unsafe(super(CIFeature, NSObject))]
128    #[derive(Debug, PartialEq, Eq, Hash)]
129    pub struct CIFaceFeature;
130);
131
132extern_conformance!(
133    unsafe impl NSObjectProtocol for CIFaceFeature {}
134);
135
136impl CIFaceFeature {
137    extern_methods!(
138        #[cfg(feature = "objc2-core-foundation")]
139        /// A rectangle indicating the position and extent of the face feature in image coordinates.
140        #[unsafe(method(bounds))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn bounds(&self) -> CGRect;
143
144        /// A Boolean value that indicates whether the detector found the face’s left eye.
145        #[unsafe(method(hasLeftEyePosition))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn hasLeftEyePosition(&self) -> bool;
148
149        #[cfg(feature = "objc2-core-foundation")]
150        /// The image coordinate of the center of the left eye.
151        ///
152        /// > Note: The left eye is on the left side of the face from the observer's perspective.
153        /// It is not the left eye from the subject's perspective.
154        #[unsafe(method(leftEyePosition))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn leftEyePosition(&self) -> CGPoint;
157
158        /// A Boolean value that indicates whether the detector found the face’s right eye.
159        #[unsafe(method(hasRightEyePosition))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn hasRightEyePosition(&self) -> bool;
162
163        #[cfg(feature = "objc2-core-foundation")]
164        /// The image coordinate of the center of the right eye.
165        ///
166        /// > Note: The right eye is on the right side of the face from the observer's perspective.
167        /// It is not the right eye from the subject's perspective.
168        #[unsafe(method(rightEyePosition))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn rightEyePosition(&self) -> CGPoint;
171
172        /// A Boolean value that indicates whether the detector found the face’s mouth.
173        #[unsafe(method(hasMouthPosition))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn hasMouthPosition(&self) -> bool;
176
177        #[cfg(feature = "objc2-core-foundation")]
178        /// The image coordinate of the center of the mouth.
179        #[unsafe(method(mouthPosition))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn mouthPosition(&self) -> CGPoint;
182
183        /// A Boolean value that indicates whether the face object has a tracking ID.
184        #[unsafe(method(hasTrackingID))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn hasTrackingID(&self) -> bool;
187
188        /// The tracking identifier of the face object.
189        ///
190        /// Core Image provides a tracking identifier for faces it detects in a video stream, which you can
191        /// use to identify when a CIFaceFeature objects detected in one video frame is the same face detected
192        /// in a previous video frame.
193        ///
194        /// This identifier persists only as long as a face is in the frame and is not associated with a specific
195        /// face. In other words, if a face moves out of the video frame and comes back into the frame later,
196        /// another ID is assigned. (Core Image detects faces, but does not recognize specific faces.)
197        #[unsafe(method(trackingID))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn trackingID(&self) -> c_int;
200
201        /// A Boolean value that indicates the face object has a tracking frame count.
202        #[unsafe(method(hasTrackingFrameCount))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn hasTrackingFrameCount(&self) -> bool;
205
206        /// The tracking frame count of the face.
207        #[unsafe(method(trackingFrameCount))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn trackingFrameCount(&self) -> c_int;
210
211        /// A Boolean value that indicates whether information about face rotation is available.
212        #[unsafe(method(hasFaceAngle))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn hasFaceAngle(&self) -> bool;
215
216        /// The rotation of the face.
217        ///
218        /// Rotation is measured counterclockwise in degrees, with zero indicating that a line drawn between
219        /// the eyes is horizontal relative to the image orientation.
220        #[unsafe(method(faceAngle))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn faceAngle(&self) -> c_float;
223
224        /// A Boolean value that indicates whether a smile is detected in the face.
225        ///
226        /// To detect smiles, ``/CIDetector/featuresInImage:options:`` needs to be called with the ``CIDetectorSmile`` option set to true.
227        #[unsafe(method(hasSmile))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn hasSmile(&self) -> bool;
230
231        /// A Boolean value that indicates whether a closed left eye is detected in the face.
232        ///
233        /// To detect closed eyes, ``/CIDetector/featuresInImage:options:`` needs to be called with the ``CIDetectorEyeBlink`` option set to true.
234        #[unsafe(method(leftEyeClosed))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn leftEyeClosed(&self) -> bool;
237
238        /// A Boolean value that indicates whether a closed right eye is detected in the face.
239        ///
240        /// To detect closed eyes, ``/CIDetector/featuresInImage:options:`` needs to be called with the ``CIDetectorEyeBlink`` option set to true.
241        #[unsafe(method(rightEyeClosed))]
242        #[unsafe(method_family = none)]
243        pub unsafe fn rightEyeClosed(&self) -> bool;
244    );
245}
246
247/// Methods declared on superclass `NSObject`.
248impl CIFaceFeature {
249    extern_methods!(
250        #[unsafe(method(init))]
251        #[unsafe(method_family = init)]
252        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
253
254        #[unsafe(method(new))]
255        #[unsafe(method_family = new)]
256        pub unsafe fn new() -> Retained<Self>;
257    );
258}
259
260extern_class!(
261    /// Information about a rectangular region detected in a still or video image.
262    ///
263    /// > Note: In macOS 10.13, iOS 11, and tvOS 11 or later, the Vision framework replaces these classes
264    /// for identifying and analyzing image features.
265    /// See
266    /// <doc
267    /// ://com.apple.documentation/documentation/vision/vndetectfacerectanglesrequest>)
268    ///
269    /// A detected rectangle feature is not necessarily rectangular in the plane of the image; rather, the
270    /// feature identifies a shape that may be rectangular in space (for example a book on a desk) but which
271    /// appears as a four-sided polygon in the image. The properties of a `CIRectangleFeature` object
272    /// identify its four corners in image coordinates.
273    ///
274    /// You can use rectangle feature detection together with the `CIPerspectiveCorrection` filter
275    /// to transform the feature to a normal orientation.
276    ///
277    /// To detect rectangles in an image or video, choose ``CIDetectorTypeRectangle`` when initializing a
278    /// ``CIDetector`` object, and use the `CIDetectorAspectRatio` and `CIDetectorFocalLength` options to
279    /// specify the approximate shape of rectangular features to search for. The detector returns at
280    /// most one rectangle feature, the most prominent found in the image.
281    ///
282    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/cirectanglefeature?language=objc)
283    #[unsafe(super(CIFeature, NSObject))]
284    #[derive(Debug, PartialEq, Eq, Hash)]
285    pub struct CIRectangleFeature;
286);
287
288extern_conformance!(
289    unsafe impl NSObjectProtocol for CIRectangleFeature {}
290);
291
292impl CIRectangleFeature {
293    extern_methods!(
294        #[cfg(feature = "objc2-core-foundation")]
295        /// A rectangle that indicates the position and extent of the rectangle feature in image coordinates.
296        ///
297        /// This property identifies the rectangular region of the image containing the detected rectangle,
298        /// not necessarily the shape of the rectangle. A detected feature is rectangular in space, but may
299        /// appear as a four-sided polygon in the image. Use the properties listed in `CIRectangleFeature` to find the
300        /// corners of the rectangle as it appears in perspective.
301        #[unsafe(method(bounds))]
302        #[unsafe(method_family = none)]
303        pub unsafe fn bounds(&self) -> CGRect;
304
305        #[cfg(feature = "objc2-core-foundation")]
306        /// The image coordinate of the upper-left corner of the detected rectangle.
307        #[unsafe(method(topLeft))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn topLeft(&self) -> CGPoint;
310
311        #[cfg(feature = "objc2-core-foundation")]
312        /// The image coordinate of the upper-right corner of the detected rectangle.
313        #[unsafe(method(topRight))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn topRight(&self) -> CGPoint;
316
317        #[cfg(feature = "objc2-core-foundation")]
318        /// The image coordinate of the lower-left corner of the detected rectangle.
319        #[unsafe(method(bottomLeft))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn bottomLeft(&self) -> CGPoint;
322
323        #[cfg(feature = "objc2-core-foundation")]
324        /// The image coordinate of the lower-right corner of the detected rectangle.
325        #[unsafe(method(bottomRight))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn bottomRight(&self) -> CGPoint;
328    );
329}
330
331/// Methods declared on superclass `NSObject`.
332impl CIRectangleFeature {
333    extern_methods!(
334        #[unsafe(method(init))]
335        #[unsafe(method_family = init)]
336        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
337
338        #[unsafe(method(new))]
339        #[unsafe(method_family = new)]
340        pub unsafe fn new() -> Retained<Self>;
341    );
342}
343
344extern_class!(
345    /// Information about a Quick Response code detected in a still or video image.
346    ///
347    /// > Note: In macOS 10.13, iOS 11, and tvOS 11 or later, the Vision framework replaces these classes
348    /// for identifying and analyzing image features.
349    /// See
350    /// <doc
351    /// ://com.apple.documentation/documentation/vision/vndetectbarcodesrequest>)
352    ///
353    /// A QR code is a two-dimensional barcode using the ISO/IEC 18004:2006 standard. The properties of
354    /// a CIQRCodeFeature object identify the corners of the barcode in the image perspective and provide
355    /// the decoded message.
356    ///
357    /// To detect QR codes in an image or video, choose ``CIDetectorTypeQRCode`` type when initializing a
358    /// ``CIDetector`` object.
359    ///
360    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/ciqrcodefeature?language=objc)
361    #[unsafe(super(CIFeature, NSObject))]
362    #[derive(Debug, PartialEq, Eq, Hash)]
363    pub struct CIQRCodeFeature;
364);
365
366extern_conformance!(
367    unsafe impl NSCoding for CIQRCodeFeature {}
368);
369
370extern_conformance!(
371    unsafe impl NSCopying for CIQRCodeFeature {}
372);
373
374unsafe impl CopyingHelper for CIQRCodeFeature {
375    type Result = Self;
376}
377
378extern_conformance!(
379    unsafe impl NSObjectProtocol for CIQRCodeFeature {}
380);
381
382extern_conformance!(
383    unsafe impl NSSecureCoding for CIQRCodeFeature {}
384);
385
386impl CIQRCodeFeature {
387    extern_methods!(
388        #[cfg(feature = "objc2-core-foundation")]
389        /// A rectangle that indicates the position and extent of the QR code feature in image coordinates.
390        ///
391        /// This property identifies the rectangular region of the image containing the detected QR code,
392        /// not necessarily the shape of the QR code. A detected feature is square in space, but may
393        /// appear as a four-sided polygon in the image. Use the properties listed in `CIQRCodeFeature` to find the
394        /// corners of the QR code as it appears in perspective.
395        #[unsafe(method(bounds))]
396        #[unsafe(method_family = none)]
397        pub unsafe fn bounds(&self) -> CGRect;
398
399        #[cfg(feature = "objc2-core-foundation")]
400        /// The image coordinate of the upper-left corner of the detected QR code.
401        #[unsafe(method(topLeft))]
402        #[unsafe(method_family = none)]
403        pub unsafe fn topLeft(&self) -> CGPoint;
404
405        #[cfg(feature = "objc2-core-foundation")]
406        /// The image coordinate of the upper-right corner of the detected QR code.
407        #[unsafe(method(topRight))]
408        #[unsafe(method_family = none)]
409        pub unsafe fn topRight(&self) -> CGPoint;
410
411        #[cfg(feature = "objc2-core-foundation")]
412        /// The image coordinate of the lower-left corner of the detected QR code.
413        #[unsafe(method(bottomLeft))]
414        #[unsafe(method_family = none)]
415        pub unsafe fn bottomLeft(&self) -> CGPoint;
416
417        #[cfg(feature = "objc2-core-foundation")]
418        /// The image coordinate of the lower-right corner of the detected QR code.
419        #[unsafe(method(bottomRight))]
420        #[unsafe(method_family = none)]
421        pub unsafe fn bottomRight(&self) -> CGPoint;
422
423        /// The string decoded from the detected barcode.
424        #[unsafe(method(messageString))]
425        #[unsafe(method_family = none)]
426        pub unsafe fn messageString(&self) -> Option<Retained<NSString>>;
427
428        #[cfg(feature = "CIBarcodeDescriptor")]
429        /// An abstract representation of a QR Code symbol.
430        ///
431        /// The property is a ``CIQRCodeDescriptor`` instance that contains the payload, symbol version,
432        /// mask pattern, and error correction level, so the QR Code can be reproduced.
433        #[unsafe(method(symbolDescriptor))]
434        #[unsafe(method_family = none)]
435        pub unsafe fn symbolDescriptor(&self) -> Option<Retained<CIQRCodeDescriptor>>;
436    );
437}
438
439/// Methods declared on superclass `NSObject`.
440impl CIQRCodeFeature {
441    extern_methods!(
442        #[unsafe(method(init))]
443        #[unsafe(method_family = init)]
444        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
445
446        #[unsafe(method(new))]
447        #[unsafe(method_family = new)]
448        pub unsafe fn new() -> Retained<Self>;
449    );
450}
451
452extern_class!(
453    /// Information about a text that was detected in a still or video image.
454    ///
455    /// > Note: In macOS 10.13, iOS 11, and tvOS 11 or later, the Vision framework replaces these classes
456    /// for identifying and analyzing image features.
457    /// See
458    /// <doc
459    /// ://com.apple.documentation/documentation/vision/vnrecognizetextrequest>)
460    ///
461    /// A detected text feature is not necessarily rectangular in the plane of the image; rather, the
462    /// feature identifies a shape that may be rectangular in space (for example a text on a sign) but which
463    /// appears as a four-sided polygon in the image. The properties of a `CITextFeature` object
464    /// identify its four corners in image coordinates.
465    ///
466    /// To detect text in an image or video, choose the ``CIDetectorTypeText`` type when initializing a
467    /// ``CIDetector`` object, and use the `CIDetectorImageOrientation` option to specify the desired
468    /// orientation for finding upright text.
469    ///
470    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/citextfeature?language=objc)
471    #[unsafe(super(CIFeature, NSObject))]
472    #[derive(Debug, PartialEq, Eq, Hash)]
473    pub struct CITextFeature;
474);
475
476extern_conformance!(
477    unsafe impl NSObjectProtocol for CITextFeature {}
478);
479
480impl CITextFeature {
481    extern_methods!(
482        #[cfg(feature = "objc2-core-foundation")]
483        /// A rectangle that indicates the position and extent of the text feature in image coordinates.
484        ///
485        /// This property identifies the rectangular region of the image containing the detected text,
486        /// not necessarily the shape of the text box. A detected feature is rectangular in space, but may
487        /// appear as a four-sided polygon in the image. Use the properties listed in `CITextFeature` to find the
488        /// corners of the rectangle as it appears in perspective.
489        #[unsafe(method(bounds))]
490        #[unsafe(method_family = none)]
491        pub unsafe fn bounds(&self) -> CGRect;
492
493        #[cfg(feature = "objc2-core-foundation")]
494        /// The image coordinate of the upper-left corner of the detected text.
495        #[unsafe(method(topLeft))]
496        #[unsafe(method_family = none)]
497        pub unsafe fn topLeft(&self) -> CGPoint;
498
499        #[cfg(feature = "objc2-core-foundation")]
500        /// The image coordinate of the upper-right corner of the detected text.
501        #[unsafe(method(topRight))]
502        #[unsafe(method_family = none)]
503        pub unsafe fn topRight(&self) -> CGPoint;
504
505        #[cfg(feature = "objc2-core-foundation")]
506        /// The image coordinate of the lower-left corner of the detected text.
507        #[unsafe(method(bottomLeft))]
508        #[unsafe(method_family = none)]
509        pub unsafe fn bottomLeft(&self) -> CGPoint;
510
511        #[cfg(feature = "objc2-core-foundation")]
512        /// The image coordinate of the lower-right corner of the detected text.
513        #[unsafe(method(bottomRight))]
514        #[unsafe(method_family = none)]
515        pub unsafe fn bottomRight(&self) -> CGPoint;
516
517        /// An array containing additional features detected within the feature.
518        ///
519        /// A text detector can identify both a major region that is likely to contain text as well
520        /// as the areas within that region that likely to contain individual text features. Such
521        /// features might be single characters, groups of closely-packed characters, or entire words.
522        ///
523        /// To detect sub-features, ``/CIDetector/featuresInImage:options:`` needs to be called with
524        /// the ``CIDetectorReturnSubFeatures`` option set to true.
525        #[unsafe(method(subFeatures))]
526        #[unsafe(method_family = none)]
527        pub unsafe fn subFeatures(&self) -> Option<Retained<NSArray>>;
528    );
529}
530
531/// Methods declared on superclass `NSObject`.
532impl CITextFeature {
533    extern_methods!(
534        #[unsafe(method(init))]
535        #[unsafe(method_family = init)]
536        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
537
538        #[unsafe(method(new))]
539        #[unsafe(method_family = new)]
540        pub unsafe fn new() -> Retained<Self>;
541    );
542}