objc2_vision/generated/
VNDetectTrajectoriesRequest.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-media")]
7use objc2_core_media::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// A request that detects trajectories of shapes (even small ones) that follow a parabolic path in a sequence of images.
14    ///
15    ///
16    /// This request detects objects moving and (once their path follows the constraint of a parabola), a VNTrajectoryObservation will be returned with the detected points and the equation describing the parabola.
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vndetecttrajectoriesrequest?language=objc)
19    #[unsafe(super(VNStatefulRequest, VNImageBasedRequest, VNRequest, NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    #[cfg(all(feature = "VNRequest", feature = "VNStatefulRequest"))]
22    pub struct VNDetectTrajectoriesRequest;
23);
24
25#[cfg(all(feature = "VNRequest", feature = "VNStatefulRequest"))]
26extern_conformance!(
27    unsafe impl NSCopying for VNDetectTrajectoriesRequest {}
28);
29
30#[cfg(all(feature = "VNRequest", feature = "VNStatefulRequest"))]
31unsafe impl CopyingHelper for VNDetectTrajectoriesRequest {
32    type Result = Self;
33}
34
35#[cfg(all(feature = "VNRequest", feature = "VNStatefulRequest"))]
36extern_conformance!(
37    unsafe impl NSObjectProtocol for VNDetectTrajectoriesRequest {}
38);
39
40#[cfg(all(feature = "VNRequest", feature = "VNStatefulRequest"))]
41impl VNDetectTrajectoriesRequest {
42    extern_methods!(
43        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
44        /// # Safety
45        ///
46        /// `completion_handler` must be a valid pointer or null.
47        #[unsafe(method(initWithFrameAnalysisSpacing:completionHandler:))]
48        #[unsafe(method_family = init)]
49        pub unsafe fn initWithFrameAnalysisSpacing_completionHandler(
50            this: Allocated<Self>,
51            frame_analysis_spacing: CMTime,
52            completion_handler: VNRequestCompletionHandler,
53        ) -> Retained<Self>;
54
55        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
56        /// Create a new request that will detect the trajectory of a shape in motion.
57        ///
58        ///
59        /// Parameter `frameAnalysisSpacing`: The reciprocal of the maximum rate at which buffers will be processed. The request will not process buffers that fall within the frameAnalysisSpacing after it has performed the analysis. The analysis is not done by wall time but by analysis of the time stamps of the samplebuffers being processed. This property is for instance useful to throttle the processing on slower devices. If this is set to kCMTimeZero then no frames get skipped in the analysis.
60        ///
61        /// Parameter `trajectoryLength`: The number of points required to analyze a parabola that indicates a trajectory. Must be at least 5.
62        ///
63        /// 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.
64        ///
65        /// # Safety
66        ///
67        /// `completion_handler` must be a valid pointer or null.
68        #[unsafe(method(initWithFrameAnalysisSpacing:trajectoryLength:completionHandler:))]
69        #[unsafe(method_family = init)]
70        pub unsafe fn initWithFrameAnalysisSpacing_trajectoryLength_completionHandler(
71            this: Allocated<Self>,
72            frame_analysis_spacing: CMTime,
73            trajectory_length: NSInteger,
74            completion_handler: VNRequestCompletionHandler,
75        ) -> Retained<Self>;
76
77        /// The number of points required to analyze a parabola that indicates a trajectory.
78        #[unsafe(method(trajectoryLength))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn trajectoryLength(&self) -> NSInteger;
81
82        /// Specifies the minimum radius of the bounding circle of the object to be tracked. This can be used to filter out noise and small objects. The default is 0.0, which means no filtering is applied. Changing the property from frame to frame can produce eratic trajectories as objects will either disappear or be added to the tracking base on this filtering. The value is specified in normalized coordinates.
83        #[unsafe(method(objectMinimumNormalizedRadius))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn objectMinimumNormalizedRadius(&self) -> c_float;
86
87        /// Setter for [`objectMinimumNormalizedRadius`][Self::objectMinimumNormalizedRadius].
88        #[unsafe(method(setObjectMinimumNormalizedRadius:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn setObjectMinimumNormalizedRadius(
91            &self,
92            object_minimum_normalized_radius: c_float,
93        );
94
95        #[deprecated]
96        #[unsafe(method(minimumObjectSize))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn minimumObjectSize(&self) -> c_float;
99
100        /// Setter for [`minimumObjectSize`][Self::minimumObjectSize].
101        #[deprecated]
102        #[unsafe(method(setMinimumObjectSize:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn setMinimumObjectSize(&self, minimum_object_size: c_float);
105
106        /// Specifies the maximum radius of the bounding circle of the object to be tracked. This can be used to filter out unwanted trajectories from larger objects moving through the scene. The default is 1.0, which means no filtering is applied. Changing the maximum from frame to frame can produce eratic trajectories as objects will either disappear or be added to the tracking base on this filtering. The size is specified in normalized coordinates.
107        #[unsafe(method(objectMaximumNormalizedRadius))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn objectMaximumNormalizedRadius(&self) -> c_float;
110
111        /// Setter for [`objectMaximumNormalizedRadius`][Self::objectMaximumNormalizedRadius].
112        #[unsafe(method(setObjectMaximumNormalizedRadius:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setObjectMaximumNormalizedRadius(
115            &self,
116            object_maximum_normalized_radius: c_float,
117        );
118
119        #[deprecated]
120        #[unsafe(method(maximumObjectSize))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn maximumObjectSize(&self) -> c_float;
123
124        /// Setter for [`maximumObjectSize`][Self::maximumObjectSize].
125        #[deprecated]
126        #[unsafe(method(setMaximumObjectSize:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn setMaximumObjectSize(&self, maximum_object_size: c_float);
129
130        #[cfg(feature = "objc2-core-media")]
131        /// Specifies the desired target frame time for processing trajectory detection. This can be used for real-time processing of frames, which requires execution with a specific amount of time. The target frame time is evaluated from frame-to-frame. If processing takes longer than this target frame time for the currect frame, it will attempt to reduce the amount of time taken by reducing the accuracy (down to a set minimum) for the next frame. If a frame takes less time than this target, then accuracy of the next frame will be increased (up to a set maximum). The default value is kCMTimeIndefinite, meaning accuracy stays at the predefined maximum.
132        #[unsafe(method(targetFrameTime))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn targetFrameTime(&self) -> CMTime;
135
136        #[cfg(feature = "objc2-core-media")]
137        /// Setter for [`targetFrameTime`][Self::targetFrameTime].
138        #[unsafe(method(setTargetFrameTime:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn setTargetFrameTime(&self, target_frame_time: CMTime);
141
142        #[cfg(feature = "VNObservation")]
143        /// Provides VNTrajectoryObservation results.
144        #[unsafe(method(results))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn results(&self) -> Option<Retained<NSArray<VNTrajectoryObservation>>>;
147    );
148}
149
150/// Methods declared on superclass `VNStatefulRequest`.
151#[cfg(all(feature = "VNRequest", feature = "VNStatefulRequest"))]
152impl VNDetectTrajectoriesRequest {
153    extern_methods!(
154        #[unsafe(method(new))]
155        #[unsafe(method_family = new)]
156        pub unsafe fn new() -> Retained<Self>;
157
158        #[unsafe(method(init))]
159        #[unsafe(method_family = init)]
160        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
161
162        #[cfg(feature = "block2")]
163        /// # Safety
164        ///
165        /// `completion_handler` must be a valid pointer or null.
166        #[unsafe(method(initWithCompletionHandler:))]
167        #[unsafe(method_family = init)]
168        pub unsafe fn initWithCompletionHandler(
169            this: Allocated<Self>,
170            completion_handler: VNRequestCompletionHandler,
171        ) -> Retained<Self>;
172    );
173}
174
175/// [Apple's documentation](https://developer.apple.com/documentation/vision/vndetecttrajectoriesrequestrevision1?language=objc)
176pub static VNDetectTrajectoriesRequestRevision1: NSUInteger = 1;