//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
#[cfg(feature = "objc2-core-image")]
use objc2_core_image::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
#[cfg(feature = "objc2-core-ml")]
use objc2_core_ml::*;
#[cfg(feature = "objc2-core-video")]
use objc2_core_video::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// VNObservation describes the results of performing a VNRequest. The result has a confidence score. The different types of requests will create different subclasses of VNObservation to return their results in properties of those subclasses.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnobservation?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNObservation {}
);
unsafe impl CopyingHelper for VNObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNObservation {}
);
impl VNObservation {
extern_methods!(
/// The unique identifier assigned to an observation.
#[unsafe(method(uuid))]
#[unsafe(method_family = none)]
pub unsafe fn uuid(&self) -> Retained<NSUUID>;
#[cfg(feature = "VNTypes")]
/// The level of confidence normalized to [0, 1] where 1 is most confident. The only exception is results coming from VNCoreMLRequest, where confidence values are forwarded as is from relevant CoreML models
///
/// Confidence can always be returned as 1.0 if confidence is not supported or has no meaning
#[unsafe(method(confidence))]
#[unsafe(method_family = none)]
pub unsafe fn confidence(&self) -> VNConfidence;
#[cfg(feature = "objc2-core-media")]
/// The duration of the observation reporting when first detected and how long it is valid.
///
/// The duration of the observation when used with a sequence of buffers. If a request does not support a timeRange or the timeRange is not known, the start time and duration will be set to 0.
#[unsafe(method(timeRange))]
#[unsafe(method_family = none)]
pub unsafe fn timeRange(&self) -> CMTimeRange;
);
}
/// Methods declared on superclass `NSObject`.
impl VNObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// VNDetectedObjectObservation is VNObservation in an image that has a location and/or dimension. Further attributes depend on the specific detected object.
///
/// All result objects (faces, scene objects, shapes etc) must extend from this class.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vndetectedobjectobservation?language=objc)
#[unsafe(super(VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNDetectedObjectObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNDetectedObjectObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNDetectedObjectObservation {}
);
unsafe impl CopyingHelper for VNDetectedObjectObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNDetectedObjectObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNDetectedObjectObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNDetectedObjectObservation {}
);
impl VNDetectedObjectObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
#[unsafe(method(observationWithBoundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(observationWithRequestRevision:boundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithRequestRevision_boundingBox(
request_revision: NSUInteger,
bounding_box: CGRect,
) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
/// The bounding box of the detected object. The coordinates are normalized to the dimensions of the processed image, with the origin at the image's lower-left corner.
#[unsafe(method(boundingBox))]
#[unsafe(method_family = none)]
pub unsafe fn boundingBox(&self) -> CGRect;
/// The resulting CVPixelBuffer from requests that generate a segmentation mask for the entire image.
#[unsafe(method(globalSegmentationMask))]
#[unsafe(method_family = none)]
pub unsafe fn globalSegmentationMask(&self) -> Option<Retained<VNPixelBufferObservation>>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNDetectedObjectObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// VNFaceObservation is the result of a face detection request or derivatives like a face landmark request.
///
/// The properties filled in this obervation depend on the request being performed. For instance, if just a VNDetectFaceRectanglesRequest was performed the landmarks will not be populated. VNFaceObservation are also used as inputs to other request as defined by the VNFaceObservationAccepting protocol. An example would be the VNDetectFaceLandmarksRequest. This can be helpful for instance if the face rectangles in an image are not derived from a VNDetectFaceRectanglesRequest but instead come from other sources like EXIF or other face detectors. In that case the client of the API creates a VNFaceObservation with the boundingBox (in normalized coordinates) that were based on those detected faces.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnfaceobservation?language=objc)
#[unsafe(super(VNDetectedObjectObservation, VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNFaceObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNFaceObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNFaceObservation {}
);
unsafe impl CopyingHelper for VNFaceObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNFaceObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNFaceObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNFaceObservation {}
);
impl VNFaceObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// Create a new VNFaceObservation with a normalized bounding box, roll and yaw.
///
/// Parameter `requestRevision`: The revision of the VNDetectFaceRectanglesRequest that provided the bounding box. If this observation is being created with data that did not originate from a Vision request, this parameter should be VNRequestRevisionUnspecified.
///
/// Parameter `roll`: The roll angle of the face, reported in radians. A positive angle corresponds to counterclockwise direction, range [-Pi, Pi). If no roll information is available, this parameter should be nil.
///
/// Parameter `yaw`: The yaw angle of the face, reported in radians. A positive angle corresponds to counterclockwise direction, range [-Pi/2, Pi/2). If no yaw information is available, this parameter should be nil.
///
/// Parameter `pitch`: The pitch angle of the face, reported in radians. A positive angle corresponds to nodding head down direction, range [-Pi/2, Pi/2]. If no pitch information is available, this parameter should be nil.
#[deprecated]
#[unsafe(method(faceObservationWithRequestRevision:boundingBox:roll:yaw:))]
#[unsafe(method_family = none)]
pub unsafe fn faceObservationWithRequestRevision_boundingBox_roll_yaw(
request_revision: NSUInteger,
bounding_box: CGRect,
roll: Option<&NSNumber>,
yaw: Option<&NSNumber>,
) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(faceObservationWithRequestRevision:boundingBox:roll:yaw:pitch:))]
#[unsafe(method_family = none)]
pub unsafe fn faceObservationWithRequestRevision_boundingBox_roll_yaw_pitch(
request_revision: NSUInteger,
bounding_box: CGRect,
roll: Option<&NSNumber>,
yaw: Option<&NSNumber>,
pitch: Option<&NSNumber>,
) -> Retained<Self>;
#[cfg(feature = "VNFaceLandmarks")]
/// The face landmarks populated by the VNDetectFaceLandmarksRequest. This is set to nil if only a VNDetectFaceRectanglesRequest was performed.
#[unsafe(method(landmarks))]
#[unsafe(method_family = none)]
pub unsafe fn landmarks(&self) -> Option<Retained<VNFaceLandmarks2D>>;
/// The capture quality of the face as a normalized value between 0.0 and 1.0 that can be used to compare the quality of the face in terms of it capture attributes (lighting, blur, position). This score can be used to compare the capture quality of a face against other captures of the same face in a given set.
#[unsafe(method(faceCaptureQuality))]
#[unsafe(method_family = none)]
pub unsafe fn faceCaptureQuality(&self) -> Option<Retained<NSNumber>>;
/// Face roll angle populated by VNDetectFaceRectanglesRequest. The roll is reported in radians, positive angle corresponds to counterclockwise direction, range [-Pi, Pi). nil value indicates that the roll angle hasn't been computed
#[unsafe(method(roll))]
#[unsafe(method_family = none)]
pub unsafe fn roll(&self) -> Option<Retained<NSNumber>>;
/// Face yaw angle populated by VNDetectFaceRectanglesRequest. The yaw is reported in radians, positive angle corresponds to counterclockwise direction, range [-Pi/2, Pi/2]. nil value indicates that the yaw angle hasn't been computed
#[unsafe(method(yaw))]
#[unsafe(method_family = none)]
pub unsafe fn yaw(&self) -> Option<Retained<NSNumber>>;
/// Face pitch angle populated by VNDetectFaceRectanglesRequest. The pitch is reported in radians, positive angle corresponds to nodding head down direction, range [-Pi/2, Pi/2]. nil value indicates that the pitch angle hasn't been computed
#[unsafe(method(pitch))]
#[unsafe(method_family = none)]
pub unsafe fn pitch(&self) -> Option<Retained<NSNumber>>;
);
}
/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNFaceObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
#[unsafe(method(observationWithBoundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(observationWithRequestRevision:boundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithRequestRevision_boundingBox(
request_revision: NSUInteger,
bounding_box: CGRect,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNFaceObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// VNClassificationObservation returns the classifcation in form of a string.
///
/// VNClassificationObservation is the observation returned by VNCoreMLRequests that using a model that is a classifier. A classifier produces an arrary (this can be a single entry) of classifications which are labels (identifiers) and confidence scores.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnclassificationobservation?language=objc)
#[unsafe(super(VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNClassificationObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNClassificationObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNClassificationObservation {}
);
unsafe impl CopyingHelper for VNClassificationObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNClassificationObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNClassificationObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNClassificationObservation {}
);
impl VNClassificationObservation {
extern_methods!(
/// The is the label or identifier of a classification request. An example classification could be a string like 'cat' or 'hotdog'. The string is defined in the model that was used for the classification. Usually these are technical labels that are not localized and not meant to be used directly to be presented to an end user in the UI.
#[unsafe(method(identifier))]
#[unsafe(method_family = none)]
pub unsafe fn identifier(&self) -> Retained<NSString>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNClassificationObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
/// PrecisionRecallAdditions.
///
/// VNClassificationObservation mave have precision/recall curves which can be used to decide on an "optimal" operation point.
/// Precision is a value in the range of [0..1] which represents the fraction of relevant instances among the retrieved instances.
/// Recall is a value in the range of [0..1] which represents the fraction of relevant instances that have been retrieved over the total amount of relevant instances.
impl VNClassificationObservation {
extern_methods!(
/// Determine whether or not precision/recall curves are available with the observation.
///
/// If this property is YES, then all other precision/recall related methods in this addition can be called.
#[unsafe(method(hasPrecisionRecallCurve))]
#[unsafe(method_family = none)]
pub unsafe fn hasPrecisionRecallCurve(&self) -> bool;
/// Determine whether or not the observation's operation point for a specific precision has a minimum recall value.
///
///
/// Parameter `minimumRecall`: The minimum recall desired for an operation point.
///
///
/// Parameter `precision`: The precision value used to select the operation point.
///
///
/// Returns: YES if the recall value for the operation point specified by a precision value has the minimum value; otherwise, NO.
#[unsafe(method(hasMinimumRecall:forPrecision:))]
#[unsafe(method_family = none)]
pub unsafe fn hasMinimumRecall_forPrecision(
&self,
minimum_recall: c_float,
precision: c_float,
) -> bool;
/// Determine whether or not the observation's operation point for a specific recall has a minimum precision value.
///
///
/// Parameter `minimumPrecision`: The minimum precision desired for an operation point.
///
///
/// Parameter `recall`: The recall value used to select the operation point.
///
///
/// Returns: YES if the precision value for the operation point specified by a recall value has the minimum value; otherwise, NO.
#[unsafe(method(hasMinimumPrecision:forRecall:))]
#[unsafe(method_family = none)]
pub unsafe fn hasMinimumPrecision_forRecall(
&self,
minimum_precision: c_float,
recall: c_float,
) -> bool;
);
}
extern_class!(
/// VNRecognizedObjectObservation is a VNDetectedObjectObservation with an array of classifications that classify the recognized object. The confidence of the classifications sum up to 1.0. It is common practice to multiply the classification confidence with the confidence of this observation.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedobjectobservation?language=objc)
#[unsafe(super(VNDetectedObjectObservation, VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNRecognizedObjectObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNRecognizedObjectObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNRecognizedObjectObservation {}
);
unsafe impl CopyingHelper for VNRecognizedObjectObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNRecognizedObjectObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNRecognizedObjectObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNRecognizedObjectObservation {}
);
impl VNRecognizedObjectObservation {
extern_methods!(
#[unsafe(method(labels))]
#[unsafe(method_family = none)]
pub unsafe fn labels(&self) -> Retained<NSArray<VNClassificationObservation>>;
);
}
/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNRecognizedObjectObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
#[unsafe(method(observationWithBoundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(observationWithRequestRevision:boundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithRequestRevision_boundingBox(
request_revision: NSUInteger,
bounding_box: CGRect,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNRecognizedObjectObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// VNCoreMLFeatureValueObservation returns the prediction of a model as an MLFeatureValue.
///
/// This is the returned observations for models that are not classifiers and that do not return an image as a prediction. The confidence for these observations is always 1.0.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vncoremlfeaturevalueobservation?language=objc)
#[unsafe(super(VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNCoreMLFeatureValueObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNCoreMLFeatureValueObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNCoreMLFeatureValueObservation {}
);
unsafe impl CopyingHelper for VNCoreMLFeatureValueObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNCoreMLFeatureValueObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNCoreMLFeatureValueObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNCoreMLFeatureValueObservation {}
);
impl VNCoreMLFeatureValueObservation {
extern_methods!(
#[cfg(feature = "objc2-core-ml")]
/// The result VNCoreMLRequest where the model produces an MLFeatureValue that is neither a classification or image. Refer to the Core ML documentation and the model itself for the handling of the content of the featureValue.
#[unsafe(method(featureValue))]
#[unsafe(method_family = none)]
pub unsafe fn featureValue(&self) -> Retained<MLFeatureValue>;
/// The name used in the model description of the CoreML model that produced this observation allowing to correlate the observation back to the output of the model.
#[unsafe(method(featureName))]
#[unsafe(method_family = none)]
pub unsafe fn featureName(&self) -> Retained<NSString>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNCoreMLFeatureValueObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// VNPixelBufferObservation returns the prediction of a model as a CVPixelBufferRef.
///
/// This is the returned observations for models that are not classifiers and return an image as a prediction. The confidence for these observations is always 1.0.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnpixelbufferobservation?language=objc)
#[unsafe(super(VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNPixelBufferObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNPixelBufferObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNPixelBufferObservation {}
);
unsafe impl CopyingHelper for VNPixelBufferObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNPixelBufferObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNPixelBufferObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNPixelBufferObservation {}
);
impl VNPixelBufferObservation {
extern_methods!(
#[cfg(feature = "objc2-core-video")]
/// The resulting image from a request like VNCoreMLRequest where the model produces an image as an output.
#[unsafe(method(pixelBuffer))]
#[unsafe(method_family = none)]
pub unsafe fn pixelBuffer(&self) -> Retained<CVPixelBuffer>;
/// The name used in the model description of the CoreML model that produced this observation allowing to correlate the observation back to the output of the model. This can be nil if the observation is not the result of a VNCoreMLRequest operation.
#[unsafe(method(featureName))]
#[unsafe(method_family = none)]
pub unsafe fn featureName(&self) -> Option<Retained<NSString>>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNPixelBufferObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// VNRectangleObservation is the result of a rectangle detector
///
/// The VNRectangleObservation has a bounding box that encompasses the rectangle found in the image. The rectangle itself is defined by the four corner point properties. The rectangle can be rotated in or even out of plane. A common use case is to use the CIPerspectiveTransform filter to correct a detected rectangle to its 'flat upright' representation. All coordinates are normalized and the coordinates can be outside the image.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnrectangleobservation?language=objc)
#[unsafe(super(VNDetectedObjectObservation, VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNRectangleObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNRectangleObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNRectangleObservation {}
);
unsafe impl CopyingHelper for VNRectangleObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNRectangleObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNRectangleObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNRectangleObservation {}
);
impl VNRectangleObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// Create a synthesized `VNRectangleObservation`.
///
/// Note: The clockwise parameter ordered `+[VNRectangleObservation rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:]` is the preferred initializer.
///
///
/// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
///
/// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
///
/// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
#[deprecated]
#[unsafe(method(rectangleObservationWithRequestRevision:topLeft:bottomLeft:bottomRight:topRight:))]
#[unsafe(method_family = none)]
pub unsafe fn rectangleObservationWithRequestRevision_topLeft_bottomLeft_bottomRight_topRight(
request_revision: NSUInteger,
top_left: CGPoint,
bottom_left: CGPoint,
bottom_right: CGPoint,
top_right: CGPoint,
) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
/// Create a synthesized `VNRectangleObservation`.
///
///
/// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
///
/// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
///
/// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
#[unsafe(method(rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:))]
#[unsafe(method_family = none)]
pub unsafe fn rectangleObservationWithRequestRevision_topLeft_topRight_bottomRight_bottomLeft(
request_revision: NSUInteger,
top_left: CGPoint,
top_right: CGPoint,
bottom_right: CGPoint,
bottom_left: CGPoint,
) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(topLeft))]
#[unsafe(method_family = none)]
pub unsafe fn topLeft(&self) -> CGPoint;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(topRight))]
#[unsafe(method_family = none)]
pub unsafe fn topRight(&self) -> CGPoint;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(bottomLeft))]
#[unsafe(method_family = none)]
pub unsafe fn bottomLeft(&self) -> CGPoint;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(bottomRight))]
#[unsafe(method_family = none)]
pub unsafe fn bottomRight(&self) -> CGPoint;
);
}
/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNRectangleObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
#[unsafe(method(observationWithBoundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(observationWithRequestRevision:boundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithRequestRevision_boundingBox(
request_revision: NSUInteger,
bounding_box: CGRect,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNRectangleObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// The VNTrajectoryObservation describes a detected trajectory with the points on the trajectory and the equation describing the trajectory. The observation also reprorts the duration describing when the trajectory was first detected (which will be in the past).
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vntrajectoryobservation?language=objc)
#[unsafe(super(VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNTrajectoryObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNTrajectoryObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNTrajectoryObservation {}
);
unsafe impl CopyingHelper for VNTrajectoryObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNTrajectoryObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNTrajectoryObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNTrajectoryObservation {}
);
impl VNTrajectoryObservation {
extern_methods!(
#[cfg(feature = "VNGeometry")]
/// The centroids of the contour being detected along the trajectory.
///
/// These are the unprocessed centroid points of the detected contour that is tracked on the trajectory. The points may be slightly off the ideal trajectory as these are the measured points that fall within the allowed tolerance. The maximum number or past points is limited by the maximum trajectory length set in the request.
#[unsafe(method(detectedPoints))]
#[unsafe(method_family = none)]
pub unsafe fn detectedPoints(&self) -> Retained<NSArray<VNPoint>>;
#[cfg(feature = "VNGeometry")]
/// The centroids of the calculated trajectory from the detected points.
///
/// These are the calculated centroid points along the ideal trajectory described by the parabolic equation. The equation and the projected points of the detected trajectory get refined over time. The maximum number of cached points is limited by the maximum points needed to describe the trajectory together with the parabolic equation.
#[unsafe(method(projectedPoints))]
#[unsafe(method_family = none)]
pub unsafe fn projectedPoints(&self) -> Retained<NSArray<VNPoint>>;
#[cfg(feature = "objc2-core-foundation")]
/// The moving average radius of the object being tracked.
///
/// This is the radius of the object at each detected point (used to determine the trajectory) averaged.
#[unsafe(method(movingAverageRadius))]
#[unsafe(method_family = none)]
pub unsafe fn movingAverageRadius(&self) -> CGFloat;
);
}
/// Methods declared on superclass `NSObject`.
impl VNTrajectoryObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// VNTextObservation Describes a text area detected by the VNRequestNameDetectTextRectangles request.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vntextobservation?language=objc)
#[unsafe(super(
VNRectangleObservation,
VNDetectedObjectObservation,
VNObservation,
NSObject
))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNTextObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNTextObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNTextObservation {}
);
unsafe impl CopyingHelper for VNTextObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNTextObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNTextObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNTextObservation {}
);
impl VNTextObservation {
extern_methods!(
/// Array of individual character bounding boxes found within the observation's boundingBox.
///
/// If the associated request indicated that it is interested in character boxes by setting the VNDetectTextRectanglesRequest reportCharacterBoxes property to
/// `true`, this property will be non-nil (but may still be empty, depending on the detection results).
#[unsafe(method(characterBoxes))]
#[unsafe(method_family = none)]
pub unsafe fn characterBoxes(&self) -> Option<Retained<NSArray<VNRectangleObservation>>>;
);
}
/// Methods declared on superclass `VNRectangleObservation`.
impl VNTextObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// Create a synthesized `VNRectangleObservation`.
///
/// Note: The clockwise parameter ordered `+[VNRectangleObservation rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:]` is the preferred initializer.
///
///
/// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
///
/// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
///
/// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
#[deprecated]
#[unsafe(method(rectangleObservationWithRequestRevision:topLeft:bottomLeft:bottomRight:topRight:))]
#[unsafe(method_family = none)]
pub unsafe fn rectangleObservationWithRequestRevision_topLeft_bottomLeft_bottomRight_topRight(
request_revision: NSUInteger,
top_left: CGPoint,
bottom_left: CGPoint,
bottom_right: CGPoint,
top_right: CGPoint,
) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
/// Create a synthesized `VNRectangleObservation`.
///
///
/// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
///
/// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
///
/// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
#[unsafe(method(rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:))]
#[unsafe(method_family = none)]
pub unsafe fn rectangleObservationWithRequestRevision_topLeft_topRight_bottomRight_bottomLeft(
request_revision: NSUInteger,
top_left: CGPoint,
top_right: CGPoint,
bottom_right: CGPoint,
bottom_left: CGPoint,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNTextObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
#[unsafe(method(observationWithBoundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(observationWithRequestRevision:boundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithRequestRevision_boundingBox(
request_revision: NSUInteger,
bounding_box: CGRect,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNTextObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// VNRecognizedText A block of recognized text. There can be multiple VNRecognizedText objects returned in a VNRecognizedTextObservation - one for each candidate.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedtext?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNRecognizedText;
);
extern_conformance!(
unsafe impl NSCoding for VNRecognizedText {}
);
extern_conformance!(
unsafe impl NSCopying for VNRecognizedText {}
);
unsafe impl CopyingHelper for VNRecognizedText {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNRecognizedText {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNRecognizedText {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNRecognizedText {}
);
impl VNRecognizedText {
extern_methods!(
/// Field that contains recognized text.
///
/// This is the top candidate of the recognized text.
#[unsafe(method(string))]
#[unsafe(method_family = none)]
pub fn string(&self) -> Retained<NSString>;
#[cfg(feature = "VNTypes")]
/// The level of confidence normalized to [0.0, 1.0] where 1.0 is most confident
#[unsafe(method(confidence))]
#[unsafe(method_family = none)]
pub fn confidence(&self) -> VNConfidence;
);
}
/// Methods declared on superclass `NSObject`.
impl VNRecognizedText {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// VNRecognizedTextObservation Describes a text area detected and recognized by the VNRecognizeTextRequest request.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedtextobservation?language=objc)
#[unsafe(super(
VNRectangleObservation,
VNDetectedObjectObservation,
VNObservation,
NSObject
))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNRecognizedTextObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNRecognizedTextObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNRecognizedTextObservation {}
);
unsafe impl CopyingHelper for VNRecognizedTextObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNRecognizedTextObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNRecognizedTextObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNRecognizedTextObservation {}
);
impl VNRecognizedTextObservation {
extern_methods!(
/// Returns the top N candidates sorted by decreasing confidence score
///
/// This will return no more than N but can be less than N candidates. The maximum number of candidates returned cannot exceed 10 candidates.
#[unsafe(method(topCandidates:))]
#[unsafe(method_family = none)]
pub fn topCandidates(
&self,
max_candidate_count: NSUInteger,
) -> Retained<NSArray<VNRecognizedText>>;
);
}
/// Methods declared on superclass `VNRectangleObservation`.
impl VNRecognizedTextObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// Create a synthesized `VNRectangleObservation`.
///
/// Note: The clockwise parameter ordered `+[VNRectangleObservation rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:]` is the preferred initializer.
///
///
/// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
///
/// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
///
/// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
#[deprecated]
#[unsafe(method(rectangleObservationWithRequestRevision:topLeft:bottomLeft:bottomRight:topRight:))]
#[unsafe(method_family = none)]
pub unsafe fn rectangleObservationWithRequestRevision_topLeft_bottomLeft_bottomRight_topRight(
request_revision: NSUInteger,
top_left: CGPoint,
bottom_left: CGPoint,
bottom_right: CGPoint,
top_right: CGPoint,
) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
/// Create a synthesized `VNRectangleObservation`.
///
///
/// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
///
/// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
///
/// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
#[unsafe(method(rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:))]
#[unsafe(method_family = none)]
pub unsafe fn rectangleObservationWithRequestRevision_topLeft_topRight_bottomRight_bottomLeft(
request_revision: NSUInteger,
top_left: CGPoint,
top_right: CGPoint,
bottom_right: CGPoint,
bottom_left: CGPoint,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNRecognizedTextObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
#[unsafe(method(observationWithBoundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(observationWithRequestRevision:boundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithRequestRevision_boundingBox(
request_revision: NSUInteger,
bounding_box: CGRect,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNRecognizedTextObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// VNBarcodeObservation Describes an area containing a barcode detected by the VNRequestNameDetectBarcodes request.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnbarcodeobservation?language=objc)
#[unsafe(super(
VNRectangleObservation,
VNDetectedObjectObservation,
VNObservation,
NSObject
))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNBarcodeObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNBarcodeObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNBarcodeObservation {}
);
unsafe impl CopyingHelper for VNBarcodeObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNBarcodeObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNBarcodeObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNBarcodeObservation {}
);
impl VNBarcodeObservation {
extern_methods!(
#[cfg(feature = "VNTypes")]
/// The symbology of the detected barcode.
#[unsafe(method(symbology))]
#[unsafe(method_family = none)]
pub unsafe fn symbology(&self) -> Retained<VNBarcodeSymbology>;
#[cfg(feature = "objc2-core-image")]
/// An object that provides symbology-specific data for the barcode.
#[unsafe(method(barcodeDescriptor))]
#[unsafe(method_family = none)]
pub unsafe fn barcodeDescriptor(&self) -> Option<Retained<CIBarcodeDescriptor>>;
/// The string representation of the barcode's payload. Depending on the symbology of the barcode and/or the payload data itself, a string representation of the payload may not be available.
#[unsafe(method(payloadStringValue))]
#[unsafe(method_family = none)]
pub unsafe fn payloadStringValue(&self) -> Option<Retained<NSString>>;
/// The raw data representation of the barcode's payload if available.
#[unsafe(method(payloadData))]
#[unsafe(method_family = none)]
pub unsafe fn payloadData(&self) -> Option<Retained<NSData>>;
/// Boolean indicating if the barcode carries any GS1 application specific data
#[unsafe(method(isGS1DataCarrier))]
#[unsafe(method_family = none)]
pub unsafe fn isGS1DataCarrier(&self) -> bool;
/// A boolean indicating if the barcode is color inverted
#[unsafe(method(isColorInverted))]
#[unsafe(method_family = none)]
pub unsafe fn isColorInverted(&self) -> bool;
#[cfg(feature = "VNTypes")]
/// Represents the supplemental composite type. Currently, this can only refer to the composite flag of the 2D symbology as part of a GS1 composite symbology.
/// This attribute only exists when the primary descriptor is the 1D symbology of a GS1 composite symbology, and of which a valid 2D counterpart has been coalesced into.
#[unsafe(method(supplementalCompositeType))]
#[unsafe(method_family = none)]
pub unsafe fn supplementalCompositeType(&self) -> VNBarcodeCompositeType;
/// Decode the supplemental code in the descriptor as a string value. Note: this property might be expensive the first time it is accessed
/// When non-NULL, and if the descriptor has supplemental raw payload data, the pointee will be set to the decoded supplemental payload string value.
#[unsafe(method(supplementalPayloadString))]
#[unsafe(method_family = none)]
pub unsafe fn supplementalPayloadString(&self) -> Option<Retained<NSString>>;
/// Decode the supplemental code in the descriptor as a string value. Note: this property might be expensive the first time it is accessed
/// When non-NULL, and if the descriptor has supplemental raw payload data, the pointee will be set to the decoded supplemental payload raw data value.
#[unsafe(method(supplementalPayloadData))]
#[unsafe(method_family = none)]
pub unsafe fn supplementalPayloadData(&self) -> Option<Retained<NSData>>;
);
}
/// Methods declared on superclass `VNRectangleObservation`.
impl VNBarcodeObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// Create a synthesized `VNRectangleObservation`.
///
/// Note: The clockwise parameter ordered `+[VNRectangleObservation rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:]` is the preferred initializer.
///
///
/// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
///
/// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
///
/// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
#[deprecated]
#[unsafe(method(rectangleObservationWithRequestRevision:topLeft:bottomLeft:bottomRight:topRight:))]
#[unsafe(method_family = none)]
pub unsafe fn rectangleObservationWithRequestRevision_topLeft_bottomLeft_bottomRight_topRight(
request_revision: NSUInteger,
top_left: CGPoint,
bottom_left: CGPoint,
bottom_right: CGPoint,
top_right: CGPoint,
) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
/// Create a synthesized `VNRectangleObservation`.
///
///
/// Parameter `requestRevision`: The revision of the VNDetectRectanglesRequest that the observation is to be treated as originating from.
///
/// Parameter `topLeft`: The top-left corner of the rectangle in normalized coordinate space.
///
/// Parameter `topRight`: The top-right corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomRight`: The bottom-right corner of the rectangle in normalized coordinate space.
///
/// Parameter `bottomLeft`: The bottom-left corner of the rectangle in normalized coordinate space.
#[unsafe(method(rectangleObservationWithRequestRevision:topLeft:topRight:bottomRight:bottomLeft:))]
#[unsafe(method_family = none)]
pub unsafe fn rectangleObservationWithRequestRevision_topLeft_topRight_bottomRight_bottomLeft(
request_revision: NSUInteger,
top_left: CGPoint,
top_right: CGPoint,
bottom_right: CGPoint,
bottom_left: CGPoint,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNBarcodeObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
#[unsafe(method(observationWithBoundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(observationWithRequestRevision:boundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithRequestRevision_boundingBox(
request_revision: NSUInteger,
bounding_box: CGRect,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNBarcodeObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// VNHorizonObservation is the result of a VNDetectHorizonRequest
///
/// Use the transform or angle to upright the image and make the detected horizon level.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnhorizonobservation?language=objc)
#[unsafe(super(VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNHorizonObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNHorizonObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNHorizonObservation {}
);
unsafe impl CopyingHelper for VNHorizonObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNHorizonObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNHorizonObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNHorizonObservation {}
);
impl VNHorizonObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// Transform applied to the detected horizon in image coordinates.
///
/// This is the transform in image coordinates and not a normalized transform.
#[unsafe(method(transform))]
#[unsafe(method_family = none)]
pub unsafe fn transform(&self) -> CGAffineTransform;
#[cfg(feature = "objc2-core-foundation")]
/// Angle of the observed horizon.
#[unsafe(method(angle))]
#[unsafe(method_family = none)]
pub unsafe fn angle(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
/// Creates a transform for the specified width and height.
#[unsafe(method(transformForImageWidth:height:))]
#[unsafe(method_family = none)]
pub unsafe fn transformForImageWidth_height(
&self,
width: usize,
height: usize,
) -> CGAffineTransform;
);
}
/// Methods declared on superclass `NSObject`.
impl VNHorizonObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// VNImageAlignmentObservation is generated from an image registration. This is an abstract base class. The type of registration request used defines which subclass describes the result.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnimagealignmentobservation?language=objc)
#[unsafe(super(VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNImageAlignmentObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNImageAlignmentObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNImageAlignmentObservation {}
);
unsafe impl CopyingHelper for VNImageAlignmentObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNImageAlignmentObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNImageAlignmentObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNImageAlignmentObservation {}
);
impl VNImageAlignmentObservation {
extern_methods!();
}
/// Methods declared on superclass `NSObject`.
impl VNImageAlignmentObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// An observation describing the results of performing a translational image alignment.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnimagetranslationalignmentobservation?language=objc)
#[unsafe(super(VNImageAlignmentObservation, VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNImageTranslationAlignmentObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNImageTranslationAlignmentObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNImageTranslationAlignmentObservation {}
);
unsafe impl CopyingHelper for VNImageTranslationAlignmentObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNImageTranslationAlignmentObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNImageTranslationAlignmentObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNImageTranslationAlignmentObservation {}
);
impl VNImageTranslationAlignmentObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(alignmentTransform))]
#[unsafe(method_family = none)]
pub unsafe fn alignmentTransform(&self) -> CGAffineTransform;
);
}
/// Methods declared on superclass `NSObject`.
impl VNImageTranslationAlignmentObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// An observation describing the results of performing a homographic image alignment.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnimagehomographicalignmentobservation?language=objc)
#[unsafe(super(VNImageAlignmentObservation, VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNImageHomographicAlignmentObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNImageHomographicAlignmentObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNImageHomographicAlignmentObservation {}
);
unsafe impl CopyingHelper for VNImageHomographicAlignmentObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNImageHomographicAlignmentObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNImageHomographicAlignmentObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNImageHomographicAlignmentObservation {}
);
impl VNImageHomographicAlignmentObservation {
extern_methods!();
}
/// Methods declared on superclass `NSObject`.
impl VNImageHomographicAlignmentObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// VNSaliencyImageObservation provides a grayscale "heat" map of important areas of an image.
///
/// In the revision1, the "heat" map is a OneComponent32Float pixel format CVPixelBuffer.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnsaliencyimageobservation?language=objc)
#[unsafe(super(VNPixelBufferObservation, VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNSaliencyImageObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNSaliencyImageObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNSaliencyImageObservation {}
);
unsafe impl CopyingHelper for VNSaliencyImageObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNSaliencyImageObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNSaliencyImageObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNSaliencyImageObservation {}
);
impl VNSaliencyImageObservation {
extern_methods!(
/// An array of bounds of salient objects within the image. Each box represents a distinct mode of the heat map.
#[unsafe(method(salientObjects))]
#[unsafe(method_family = none)]
pub unsafe fn salientObjects(&self) -> Option<Retained<NSArray<VNRectangleObservation>>>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNSaliencyImageObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/vision/vnfeatureprintobservation?language=objc)
#[unsafe(super(VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNFeaturePrintObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNFeaturePrintObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNFeaturePrintObservation {}
);
unsafe impl CopyingHelper for VNFeaturePrintObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNFeaturePrintObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNFeaturePrintObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNFeaturePrintObservation {}
);
impl VNFeaturePrintObservation {
extern_methods!(
#[cfg(feature = "VNTypes")]
/// The type of each element in the data.
#[unsafe(method(elementType))]
#[unsafe(method_family = none)]
pub unsafe fn elementType(&self) -> VNElementType;
/// The total number of elements in the data.
#[unsafe(method(elementCount))]
#[unsafe(method_family = none)]
pub unsafe fn elementCount(&self) -> NSUInteger;
/// The feature print data.
#[unsafe(method(data))]
#[unsafe(method_family = none)]
pub unsafe fn data(&self) -> Retained<NSData>;
/// Computes the distance between two observations.
///
/// The larger the distance the more dissimlar the feature prints are. In case of an error this method returns false with an error describing the error condition, for instance comparing two non-comparable feature prints.
///
/// # Safety
///
/// `out_distance` must be a valid pointer.
#[unsafe(method(computeDistance:toFeaturePrintObservation:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn computeDistance_toFeaturePrintObservation_error(
&self,
out_distance: NonNull<c_float>,
feature_print: &VNFeaturePrintObservation,
) -> Result<(), Retained<NSError>>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNFeaturePrintObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/vision/vncontoursobservation?language=objc)
#[unsafe(super(VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNContoursObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNContoursObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNContoursObservation {}
);
unsafe impl CopyingHelper for VNContoursObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNContoursObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNContoursObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNContoursObservation {}
);
impl VNContoursObservation {
extern_methods!(
/// The total number of contours detected.
#[unsafe(method(contourCount))]
#[unsafe(method_family = none)]
pub unsafe fn contourCount(&self) -> NSInteger;
#[cfg(feature = "VNGeometry")]
/// Returns the VNContour object at the specified index, irrespective of hierarchy.
///
/// Parameter `contourIndex`: The index of the contour to request. Valid values are in the range [0..contourCount-1].
///
/// Parameter `error`: The error returned if the index path is out of range.
///
/// Returns: The detected VNContour at the specified index without regard to hierarchy.
#[unsafe(method(contourAtIndex:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn contourAtIndex_error(
&self,
contour_index: NSInteger,
) -> Result<Retained<VNContour>, Retained<NSError>>;
/// The total number of top-level contours detected.
#[unsafe(method(topLevelContourCount))]
#[unsafe(method_family = none)]
pub unsafe fn topLevelContourCount(&self) -> NSInteger;
#[cfg(feature = "VNGeometry")]
/// An array of the top level contours (i.e. contours that are not enclosed inside another contour),.
///
/// This array constitutes the top of the contour hierarchy. Each contour object can be further iterated to determine its children.
///
/// See: VNContour for more information.
#[unsafe(method(topLevelContours))]
#[unsafe(method_family = none)]
pub unsafe fn topLevelContours(&self) -> Retained<NSArray<VNContour>>;
#[cfg(feature = "VNGeometry")]
/// Returns the VNContour object at the specified index path.
///
/// Use the indexPath property from a VNContour instance to pass to this method.
///
/// Parameter `indexPath`: The index path is the heirarchical path to the contour.
///
/// Parameter `error`: The error returned if the index path is out of range.
///
/// Returns: The VNContour object at the specified index path.
#[unsafe(method(contourAtIndexPath:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn contourAtIndexPath_error(
&self,
index_path: &NSIndexPath,
) -> Result<Retained<VNContour>, Retained<NSError>>;
#[cfg(feature = "objc2-core-graphics")]
/// Obtain all of the contours represented as a CGPath in normalized coordinates.
///
/// The path is owned by the observation and therefore will be alive as long as the the observation is alive.
#[unsafe(method(normalizedPath))]
#[unsafe(method_family = none)]
pub unsafe fn normalizedPath(&self) -> Retained<CGPath>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNContoursObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedpointgroupkeyall?language=objc)
#[cfg(feature = "VNTypes")]
pub static VNRecognizedPointGroupKeyAll: &'static VNRecognizedPointGroupKey;
}
extern_class!(
/// VNRecognizedPointsObservation is a request result detailing points in an image.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedpointsobservation?language=objc)
#[unsafe(super(VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNRecognizedPointsObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNRecognizedPointsObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNRecognizedPointsObservation {}
);
unsafe impl CopyingHelper for VNRecognizedPointsObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNRecognizedPointsObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNRecognizedPointsObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNRecognizedPointsObservation {}
);
impl VNRecognizedPointsObservation {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "VNTypes")]
/// Returns all of the point group keys available in the observation.
#[unsafe(method(availableKeys))]
#[unsafe(method_family = none)]
pub unsafe fn availableKeys(&self) -> Retained<NSArray<VNRecognizedPointKey>>;
#[cfg(feature = "VNTypes")]
/// The availableGroupKeys property returns all of the point group labels usable with the observation.
#[unsafe(method(availableGroupKeys))]
#[unsafe(method_family = none)]
pub unsafe fn availableGroupKeys(&self) -> Retained<NSArray<VNRecognizedPointGroupKey>>;
#[cfg(all(
feature = "VNDetectedPoint",
feature = "VNGeometry",
feature = "VNTypes"
))]
/// Obtains a specific normalized recognized point.
///
///
/// Parameter `pointKey`: The key specifying the desired recognized point.
///
///
/// Parameter `error`: The address of a variable that will be populated with the error that describes the failure. If the caller does not require this information, NULL can be passed.
///
///
/// Returns: the recognized point, or nil if the specific point is not defined.
#[unsafe(method(recognizedPointForKey:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn recognizedPointForKey_error(
&self,
point_key: &VNRecognizedPointKey,
) -> Result<Retained<VNRecognizedPoint>, Retained<NSError>>;
#[cfg(all(
feature = "VNDetectedPoint",
feature = "VNGeometry",
feature = "VNTypes"
))]
/// Obtains the collection of points associated with an identified grouping.
///
///
/// The obtained collection is a dictionary that provides the mapping of a recognized point's key to the recognized point.
///
///
/// Parameter `groupKey`: The key representing a specific grouping of points.
///
/// Parameter `error`: The address of a variable that will be populated with the error that describes the failure. If the caller does not require this information, NULL can be passed.
///
/// Returns: the dictionary of recognized points in the group, or nil if an error was encountered.
#[unsafe(method(recognizedPointsForGroupKey:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn recognizedPointsForGroupKey_error(
&self,
group_key: &VNRecognizedPointGroupKey,
) -> Result<
Retained<NSDictionary<VNRecognizedPointKey, VNRecognizedPoint>>,
Retained<NSError>,
>;
#[cfg(feature = "objc2-core-ml")]
/// Returns the recognized points packaged into an MLMultiArray.
///
///
/// The MLMultiArray will contain the raw data output of (x coordinate, y coordinate, confidence) for specific points in the format expected by CreateML action recognition models.
/// The datatype of the elements in the array is double and the dimensions are [1, 3, # of possible points]. If an expected point key is not available in the obeservation, that entry in the MLMultiArray will be populated with 0s.
///
///
/// Parameter `error`: The address of a variable that will be populated with the error that describes the failure. If the caller does not require this information, NULL can be passed.
///
///
/// Returns: the MLMultiArray representation of the points, or nil if an error was encountered.
#[unsafe(method(keypointsMultiArrayAndReturnError:_))]
#[unsafe(method_family = none)]
pub unsafe fn keypointsMultiArrayAndReturnError(
&self,
) -> Result<Retained<MLMultiArray>, Retained<NSError>>;
);
}
extern_class!(
/// VNHumanObservation is the result of a Human rectangles detection request
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnhumanobservation?language=objc)
#[unsafe(super(VNDetectedObjectObservation, VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNHumanObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNHumanObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNHumanObservation {}
);
unsafe impl CopyingHelper for VNHumanObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNHumanObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNHumanObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNHumanObservation {}
);
impl VNHumanObservation {
extern_methods!(
/// Boolean property to specify whether the human upper body or full body detection is recorded in the observation. This setting is propagated from [VNDetectHumanRectanglesRequest -upperBodyOnly]
#[unsafe(method(upperBodyOnly))]
#[unsafe(method_family = none)]
pub unsafe fn upperBodyOnly(&self) -> bool;
);
}
/// Methods declared on superclass `VNDetectedObjectObservation`.
impl VNHumanObservation {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// create a new VNDetectedObjectObservation with a normalized bounding box and a confidence of 1.0.
#[unsafe(method(observationWithBoundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithBoundingBox(bounding_box: CGRect) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(observationWithRequestRevision:boundingBox:))]
#[unsafe(method_family = none)]
pub unsafe fn observationWithRequestRevision_boundingBox(
request_revision: NSUInteger,
bounding_box: CGRect,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNHumanObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// An observation resulting from an instance mask generation request. It contains an instance mask that labels instances in the mask that labels per pixel an instance.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vninstancemaskobservation?language=objc)
#[unsafe(super(VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNInstanceMaskObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNInstanceMaskObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNInstanceMaskObservation {}
);
unsafe impl CopyingHelper for VNInstanceMaskObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNInstanceMaskObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNInstanceMaskObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNInstanceMaskObservation {}
);
impl VNInstanceMaskObservation {
extern_methods!(
#[cfg(feature = "objc2-core-video")]
/// The resulting mask represents all instances in a mask image where 0 represents the background and all other values represent the indices of the instances identified.
/// Note that a pixel can only correspond to one instance and not multiple instances.
#[unsafe(method(instanceMask))]
#[unsafe(method_family = none)]
pub unsafe fn instanceMask(&self) -> Retained<CVPixelBuffer>;
/// *The IndexSet that encompases all instances except the background
#[unsafe(method(allInstances))]
#[unsafe(method_family = none)]
pub unsafe fn allInstances(&self) -> Retained<NSIndexSet>;
#[cfg(feature = "objc2-core-video")]
/// The low res mask from the selected instances in the resolution of the performed analysis which is not upscaled to the image resolution.
///
/// Parameter `instances`: An NSIndexSet of selected instances where 0 is the background. An empty set selects all instances but the background
///
/// Parameter `error`: The address of a variable that will be populated with the error that describes the failure. If the caller does not require this information, NULL can be passed.
/// The pixel format of kCVPixelFormatType_OneComponent32Float
#[unsafe(method(generateMaskForInstances:error:_))]
// required for soundness, method has `returns_retained` attribute.
#[unsafe(method_family = copy)]
pub unsafe fn generateMaskForInstances_error(
&self,
instances: &NSIndexSet,
) -> Result<Retained<CVPixelBuffer>, Retained<NSError>>;
#[cfg(all(feature = "VNRequestHandler", feature = "objc2-core-video"))]
/// High res image with everything but the selected instances removed to transparent black.
///
/// Parameter `instances`: An NSIndexSet of selected instances where 0 is the background.
///
/// Parameter `croppedToInstancesExtent`: Crops the image to the smallest rectangle containg all instances with remaining alpha elements.
/// Setting this value to NO does not perform any cropping.
///
/// Parameter `error`: The address of a variable that will be populated with the error that describes the failure. If the caller does not require this information, NULL can be passed.
#[unsafe(method(generateMaskedImageOfInstances:fromRequestHandler:croppedToInstancesExtent:error:_))]
// required for soundness, method has `returns_retained` attribute.
#[unsafe(method_family = copy)]
pub unsafe fn generateMaskedImageOfInstances_fromRequestHandler_croppedToInstancesExtent_error(
&self,
instances: &NSIndexSet,
request_handler: &VNImageRequestHandler,
crop_result: bool,
) -> Result<Retained<CVPixelBuffer>, Retained<NSError>>;
#[cfg(all(feature = "VNRequestHandler", feature = "objc2-core-video"))]
/// High res mask with the selected instances preserved while everything else is removed to transparent black.
///
/// Parameter `forInstances`: An NSIndexSet of selected instances where 0 is the background.
///
/// Parameter `error`: The address of a variable that will be populated with the error that describes the failure. If the caller does not require this information, NULL can be passed.
#[unsafe(method(generateScaledMaskForImageForInstances:fromRequestHandler:error:_))]
// required for soundness, method has `returns_retained` attribute.
#[unsafe(method_family = copy)]
pub unsafe fn generateScaledMaskForImageForInstances_fromRequestHandler_error(
&self,
instances: &NSIndexSet,
request_handler: &VNImageRequestHandler,
) -> Result<Retained<CVPixelBuffer>, Retained<NSError>>;
);
}
/// Methods declared on superclass `NSObject`.
impl VNInstanceMaskObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/vision/vnanimalbodyposeobservation?language=objc)
#[unsafe(super(VNRecognizedPointsObservation, VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNAnimalBodyPoseObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNAnimalBodyPoseObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNAnimalBodyPoseObservation {}
);
unsafe impl CopyingHelper for VNAnimalBodyPoseObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNAnimalBodyPoseObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNAnimalBodyPoseObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNAnimalBodyPoseObservation {}
);
impl VNAnimalBodyPoseObservation {
extern_methods!(
#[cfg(feature = "VNTypes")]
/// All animal joint names available in the observation.
#[unsafe(method(availableJointNames))]
#[unsafe(method_family = none)]
pub unsafe fn availableJointNames(
&self,
) -> Retained<NSArray<VNAnimalBodyPoseObservationJointName>>;
#[cfg(feature = "VNTypes")]
/// All animal joints group names available in the observation.
#[unsafe(method(availableJointGroupNames))]
#[unsafe(method_family = none)]
pub unsafe fn availableJointGroupNames(
&self,
) -> Retained<NSArray<VNAnimalBodyPoseObservationJointsGroupName>>;
#[cfg(all(
feature = "VNDetectedPoint",
feature = "VNGeometry",
feature = "VNTypes"
))]
/// Obtain a specific normalized point for a named animal body joint.
///
///
/// Parameter `jointName`: The name of the animal body joint.
///
/// Parameter `error`: The address of a variable that will be populated with the error that describes the failure. If the caller does not require this information, NULL can be passed.
///
/// Returns: the recognized point, or nil if the point could not be obtained.
#[unsafe(method(recognizedPointForJointName:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn recognizedPointForJointName_error(
&self,
joint_name: &VNAnimalBodyPoseObservationJointName,
) -> Result<Retained<VNRecognizedPoint>, Retained<NSError>>;
#[cfg(all(
feature = "VNDetectedPoint",
feature = "VNGeometry",
feature = "VNTypes"
))]
/// Obtains the collection of points associated with a named animal body joints group.
///
///
/// The obtained collection is a dictionary that provides the mapping of animal join names to the recognized point.
///
///
/// Parameter `jointsGroupName`: The name of the animal body joints group.
///
/// Parameter `error`: The address of a variable that will be populated with the error that describes the failure. If the caller does not require this information, NULL can be passed.
///
/// Returns: a dictionary of recognized points in the group, or nil if an error was encountered.
#[unsafe(method(recognizedPointsForJointsGroupName:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn recognizedPointsForJointsGroupName_error(
&self,
joints_group_name: &VNAnimalBodyPoseObservationJointsGroupName,
) -> Result<
Retained<NSDictionary<VNAnimalBodyPoseObservationJointName, VNRecognizedPoint>>,
Retained<NSError>,
>;
);
}
/// Methods declared on superclass `VNRecognizedPointsObservation`.
impl VNAnimalBodyPoseObservation {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedpoint3dgroupkeyall?language=objc)
#[cfg(feature = "VNTypes")]
pub static VNRecognizedPoint3DGroupKeyAll: &'static VNRecognizedPointGroupKey;
}
extern_class!(
/// Observation
///
/// VNRecognizedPointsObservation is a request result detailing points in an image.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnrecognizedpoints3dobservation?language=objc)
#[unsafe(super(VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNRecognizedPoints3DObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNRecognizedPoints3DObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNRecognizedPoints3DObservation {}
);
unsafe impl CopyingHelper for VNRecognizedPoints3DObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNRecognizedPoints3DObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNRecognizedPoints3DObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNRecognizedPoints3DObservation {}
);
impl VNRecognizedPoints3DObservation {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "VNTypes")]
/// Returns all of the point group keys available in the observation.
#[unsafe(method(availableKeys))]
#[unsafe(method_family = none)]
pub unsafe fn availableKeys(&self) -> Retained<NSArray<VNRecognizedPointKey>>;
#[cfg(feature = "VNTypes")]
/// The availableGroupKeys property returns all of the point group labels usable with the observation.
#[unsafe(method(availableGroupKeys))]
#[unsafe(method_family = none)]
pub unsafe fn availableGroupKeys(&self) -> Retained<NSArray<VNRecognizedPointGroupKey>>;
#[cfg(all(
feature = "VNGeometry",
feature = "VNRecognizedPoint3D",
feature = "VNTypes"
))]
/// Obtains a specific normalized recognized point.
///
/// Parameter `pointKey`: The key specifying the desired recognized point.
///
/// Parameter `error`: The address of a variable that will be populated with the error that describes the failure. If the caller does not require this information, NULL can be passed.
///
/// Returns: the recognized point, or nil if the specific point is not defined.
#[unsafe(method(recognizedPointForKey:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn recognizedPointForKey_error(
&self,
point_key: &VNRecognizedPointKey,
) -> Result<Retained<VNRecognizedPoint3D>, Retained<NSError>>;
#[cfg(all(
feature = "VNGeometry",
feature = "VNRecognizedPoint3D",
feature = "VNTypes"
))]
/// Obtains the collection of points associated with an identified grouping.
///
/// The obtained collection is a dictionary that provides the mapping of a recognized point's key to the recognized point.
///
/// Parameter `groupKey`: The key representing a specific grouping of points.
///
/// Parameter `error`: The address of a variable that will be populated with the error that describes the failure. If the caller does not require this information, NULL can be passed.
///
/// Returns: the dictionary of recognized points in the group, or nil if an error was encountered.
#[unsafe(method(recognizedPointsForGroupKey:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn recognizedPointsForGroupKey_error(
&self,
group_key: &VNRecognizedPointGroupKey,
) -> Result<
Retained<NSDictionary<VNRecognizedPointKey, VNRecognizedPoint3D>>,
Retained<NSError>,
>;
);
}
/// Height estimation technique used in observation based on available metadata
/// VNHumanBodyPose3DObservationHeightEstimationReference is the default if no LiDAR depth is present
///
/// reference - Since no depth was present, a reference height of 1.8 meters is used
/// measured - LiDAR depth was used to measure a more accurate `bodyHeight` in meters
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnhumanbodypose3dobservationheightestimation?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct VNHumanBodyPose3DObservationHeightEstimation(pub NSInteger);
impl VNHumanBodyPose3DObservationHeightEstimation {
#[doc(alias = "VNHumanBodyPose3DObservationHeightEstimationReference")]
pub const Reference: Self = Self(0);
#[doc(alias = "VNHumanBodyPose3DObservationHeightEstimationMeasured")]
pub const Measured: Self = Self(1);
}
unsafe impl Encode for VNHumanBodyPose3DObservationHeightEstimation {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for VNHumanBodyPose3DObservationHeightEstimation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/vision/vnhumanbodypose3dobservation?language=objc)
#[unsafe(super(VNRecognizedPoints3DObservation, VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNHumanBodyPose3DObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNHumanBodyPose3DObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNHumanBodyPose3DObservation {}
);
unsafe impl CopyingHelper for VNHumanBodyPose3DObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNHumanBodyPose3DObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNHumanBodyPose3DObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNHumanBodyPose3DObservation {}
);
impl VNHumanBodyPose3DObservation {
extern_methods!(
/// Technique used to estimate body height. `VNHumanBodyPose3DObservationHeightEstimationMeasured` indicates`bodyHeight` returns measured height in meters more accurate to true world height.
/// `VNHumanBodyPose3DObservationHeightEstimationReference` indicates `bodyHeight` returns reference height of 1.8 m
#[unsafe(method(heightEstimation))]
#[unsafe(method_family = none)]
pub unsafe fn heightEstimation(&self) -> VNHumanBodyPose3DObservationHeightEstimation;
#[cfg(feature = "VNTypes")]
/// All of the joints group names available in the observation.
#[unsafe(method(availableJointsGroupNames))]
#[unsafe(method_family = none)]
pub unsafe fn availableJointsGroupNames(
&self,
) -> Retained<NSArray<VNHumanBodyPose3DObservationJointsGroupName>>;
#[cfg(feature = "VNTypes")]
/// All of the joint names available in the observation.
#[unsafe(method(availableJointNames))]
#[unsafe(method_family = none)]
pub unsafe fn availableJointNames(
&self,
) -> Retained<NSArray<VNHumanBodyPose3DObservationJointName>>;
/// Estimated human height, in meters.
///
/// Note: A measured height will be returned in meters if `heightEstimation` is `VNHumanBodyPose3DObservationHeightEstimationMeasured`, otherwise reference height of 1.8 meters is returned for `VNHumanBodyPose3DObservationHeightEstimationReference`
#[unsafe(method(bodyHeight))]
#[unsafe(method_family = none)]
pub unsafe fn bodyHeight(&self) -> c_float;
#[cfg(all(
feature = "VNGeometry",
feature = "VNHumanBodyRecognizedPoint3D",
feature = "VNRecognizedPoint3D",
feature = "VNTypes"
))]
/// Obtains the collection of joints associated with a named human body joints group.
///
/// The obtained collection is a dictionary that provides the mapping of human joint names to the recognized point.
///
/// Parameter `jointsGroupName`: The name of the human body joints group.
///
/// Parameter `error`: The address of a variable that will be populated with the error that describes the failure. If the caller does not require this information, NULL can be passed.
///
/// Returns: a dictionary of recognized points in the group, or nil if an error was encountered.
#[unsafe(method(recognizedPointsForJointsGroupName:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn recognizedPointsForJointsGroupName_error(
&self,
joints_group_name: &VNHumanBodyPose3DObservationJointsGroupName,
) -> Result<
Retained<
NSDictionary<VNHumanBodyPose3DObservationJointName, VNHumanBodyRecognizedPoint3D>,
>,
Retained<NSError>,
>;
#[cfg(all(
feature = "VNGeometry",
feature = "VNHumanBodyRecognizedPoint3D",
feature = "VNRecognizedPoint3D",
feature = "VNTypes"
))]
/// Obtain a specific point for a named human body joint.
/// Each returned `VNHumanBodyRecognizedPoint3D` instance contains position relative to the model (`position`) and the parent joint (`localPosition`)
/// Model position is relative to root joint (hip) for a named human body joint in meters .
/// Local position is relative to parent joint for a named human body joint in meters.
///
/// Parameter `jointName`: The name of the human body joint.
///
/// Parameter `error`: The address of a variable that will be populated with the error that describes the failure. If the caller does not require this information, NULL can be passed.
///
/// Returns: The recognized point, or nil if the point could not be obtained.
#[unsafe(method(recognizedPointForJointName:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn recognizedPointForJointName_error(
&self,
joint_name: &VNHumanBodyPose3DObservationJointName,
) -> Result<Retained<VNHumanBodyRecognizedPoint3D>, Retained<NSError>>;
#[cfg(all(feature = "VNGeometry", feature = "VNTypes"))]
/// Obtain 2D point relative to the input image for named human body joint
///
/// Parameter `jointName`: The name of the human body joint
///
/// Returns: A projection of the determined 3D position onto the original 2D image in normalized, lower left origin coordinates
#[unsafe(method(pointInImageForJointName:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn pointInImageForJointName_error(
&self,
joint_name: &VNHumanBodyPose3DObservationJointName,
) -> Result<Retained<VNPoint>, Retained<NSError>>;
#[cfg(feature = "VNTypes")]
/// Obtain the parent joint of a specified joint
///
/// Parameter `jointName`: The name of the human body joint
///
/// Returns: The name of the parent joint
#[unsafe(method(parentJointNameForJointName:))]
#[unsafe(method_family = none)]
pub unsafe fn parentJointNameForJointName(
&self,
joint_name: &VNHumanBodyPose3DObservationJointName,
) -> Option<Retained<VNHumanBodyPose3DObservationJointName>>;
);
}
/// Methods declared on superclass `VNRecognizedPoints3DObservation`.
impl VNHumanBodyPose3DObservation {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
extern_class!(
/// VNImageAestheticsScoresObservation provides an overall score of aesthetic attributes for an image.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnimageaestheticsscoresobservation?language=objc)
#[unsafe(super(VNObservation, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNImageAestheticsScoresObservation;
);
extern_conformance!(
unsafe impl NSCoding for VNImageAestheticsScoresObservation {}
);
extern_conformance!(
unsafe impl NSCopying for VNImageAestheticsScoresObservation {}
);
unsafe impl CopyingHelper for VNImageAestheticsScoresObservation {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNImageAestheticsScoresObservation {}
);
extern_conformance!(
unsafe impl NSSecureCoding for VNImageAestheticsScoresObservation {}
);
#[cfg(feature = "VNRequestRevisionProviding")]
extern_conformance!(
unsafe impl VNRequestRevisionProviding for VNImageAestheticsScoresObservation {}
);
impl VNImageAestheticsScoresObservation {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
/// A Boolean value that represents images that are not necessarily of poor image quality, but may not have memorable or exciting content.
#[unsafe(method(isUtility))]
#[unsafe(method_family = none)]
pub unsafe fn isUtility(&self) -> bool;
/// A score which incorporates aesthetic score, failure score, and utility labels.
///
/// This returns a value within the range of `-1` and `1`, where `-1` is least desirable and `1` is most desirable.
#[unsafe(method(overallScore))]
#[unsafe(method_family = none)]
pub unsafe fn overallScore(&self) -> c_float;
);
}
/// Methods declared on superclass `NSObject`.
impl VNImageAestheticsScoresObservation {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}