1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//! 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::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// A request that will detect the contours for the edges in an image.
///
///
/// This request will produce a VNContoursObservation which describes the contours.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vndetectcontoursrequest?language=objc)
#[unsafe(super(VNImageBasedRequest, VNRequest, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "VNRequest")]
pub struct VNDetectContoursRequest;
);
#[cfg(feature = "VNRequest")]
extern_conformance!(
unsafe impl NSCopying for VNDetectContoursRequest {}
);
#[cfg(feature = "VNRequest")]
unsafe impl CopyingHelper for VNDetectContoursRequest {
type Result = Self;
}
#[cfg(feature = "VNRequest")]
extern_conformance!(
unsafe impl NSObjectProtocol for VNDetectContoursRequest {}
);
#[cfg(feature = "VNRequest")]
impl VNDetectContoursRequest {
extern_methods!(
/// The amount to adjust the image's contrast by.
/// A value of +1.0 means that the contrast is not adjusted. The default value is +2.0.
///
/// Contour detection works best with high contrast images. The default value of 2 doubles the image's contrast to aid in detection. If the image already has a high contrast then this value should be set to 1.
#[unsafe(method(contrastAdjustment))]
#[unsafe(method_family = none)]
pub unsafe fn contrastAdjustment(&self) -> c_float;
/// Setter for [`contrastAdjustment`][Self::contrastAdjustment].
#[unsafe(method(setContrastAdjustment:))]
#[unsafe(method_family = none)]
pub unsafe fn setContrastAdjustment(&self, contrast_adjustment: c_float);
/// The pixel value to use as a pivot for the contrast. Valid values are from [0.0 ... +1.0], or nil to auto-detect based on image intensity.
/// The default value is +0.5 (i.e. pixel center).
#[unsafe(method(contrastPivot))]
#[unsafe(method_family = none)]
pub unsafe fn contrastPivot(&self) -> Option<Retained<NSNumber>>;
/// Setter for [`contrastPivot`][Self::contrastPivot].
#[unsafe(method(setContrastPivot:))]
#[unsafe(method_family = none)]
pub unsafe fn setContrastPivot(&self, contrast_pivot: Option<&NSNumber>);
/// Identifies to the request if detecting a dark object on a light background, or vice versa, to aid in detection. The default value is YES.
#[unsafe(method(detectsDarkOnLight))]
#[unsafe(method_family = none)]
pub unsafe fn detectsDarkOnLight(&self) -> bool;
/// Setter for [`detectsDarkOnLight`][Self::detectsDarkOnLight].
#[unsafe(method(setDetectsDarkOnLight:))]
#[unsafe(method_family = none)]
pub unsafe fn setDetectsDarkOnLight(&self, detects_dark_on_light: bool);
#[deprecated]
#[unsafe(method(detectDarkOnLight))]
#[unsafe(method_family = none)]
pub unsafe fn detectDarkOnLight(&self) -> bool;
/// Setter for [`detectDarkOnLight`][Self::detectDarkOnLight].
#[deprecated]
#[unsafe(method(setDetectDarkOnLight:))]
#[unsafe(method_family = none)]
pub unsafe fn setDetectDarkOnLight(&self, detect_dark_on_light: bool);
/// The limit on the maximum dimension of the image to be used for contour detection. Valid range of values is [64 ... NSUIntegerMax]. The default value is 512.
///
/// As the contour request is compute intensive, the input image is scaled down maintaining aspect ratio (if needed), such that its maximum dimension is the value of this property. The image never gets scaled up, so specifying the maximum value ensures that the image gets processed in its original size and not downscaled.
#[unsafe(method(maximumImageDimension))]
#[unsafe(method_family = none)]
pub unsafe fn maximumImageDimension(&self) -> NSUInteger;
/// Setter for [`maximumImageDimension`][Self::maximumImageDimension].
#[unsafe(method(setMaximumImageDimension:))]
#[unsafe(method_family = none)]
pub unsafe fn setMaximumImageDimension(&self, maximum_image_dimension: NSUInteger);
#[cfg(feature = "VNObservation")]
/// VNContoursObservation results.
#[unsafe(method(results))]
#[unsafe(method_family = none)]
pub unsafe fn results(&self) -> Option<Retained<NSArray<VNContoursObservation>>>;
);
}
/// Methods declared on superclass `VNRequest`.
#[cfg(feature = "VNRequest")]
impl VNDetectContoursRequest {
extern_methods!(
/// Creates a new VNRequest with no completion handler.
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "block2")]
/// Creates a new VNRequest with an optional completion handler.
///
///
/// Parameter `completionHandler`: The block to be invoked after the request has completed its processing. The completion handler gets executed on the same dispatch queue as the request being executed.
///
/// # Safety
///
/// `completion_handler` must be a valid pointer or null.
#[unsafe(method(initWithCompletionHandler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCompletionHandler(
this: Allocated<Self>,
completion_handler: VNRequestCompletionHandler,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "VNRequest")]
impl VNDetectContoursRequest {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
/// [Apple's documentation](https://developer.apple.com/documentation/vision/vndetectcontourrequestrevision1?language=objc)
pub static VNDetectContourRequestRevision1: NSUInteger = 1;