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        #[unsafe(method(initWithFrameAnalysisSpacing:completionHandler:))]
45        #[unsafe(method_family = init)]
46        pub unsafe fn initWithFrameAnalysisSpacing_completionHandler(
47            this: Allocated<Self>,
48            frame_analysis_spacing: CMTime,
49            completion_handler: VNRequestCompletionHandler,
50        ) -> Retained<Self>;
51
52        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
53        /// Create a new request that will detect the trajectory of a shape in motion.
54        ///
55        ///
56        /// 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.
57        ///
58        /// Parameter `trajectoryLength`: The number of points required to analyze a parabola that indicates a trajectory. Must be at least 5.
59        ///
60        /// 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.
61        #[unsafe(method(initWithFrameAnalysisSpacing:trajectoryLength:completionHandler:))]
62        #[unsafe(method_family = init)]
63        pub unsafe fn initWithFrameAnalysisSpacing_trajectoryLength_completionHandler(
64            this: Allocated<Self>,
65            frame_analysis_spacing: CMTime,
66            trajectory_length: NSInteger,
67            completion_handler: VNRequestCompletionHandler,
68        ) -> Retained<Self>;
69
70        /// The number of points required to analyze a parabola that indicates a trajectory.
71        #[unsafe(method(trajectoryLength))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn trajectoryLength(&self) -> NSInteger;
74
75        /// 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.
76        #[unsafe(method(objectMinimumNormalizedRadius))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn objectMinimumNormalizedRadius(&self) -> c_float;
79
80        /// Setter for [`objectMinimumNormalizedRadius`][Self::objectMinimumNormalizedRadius].
81        #[unsafe(method(setObjectMinimumNormalizedRadius:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn setObjectMinimumNormalizedRadius(
84            &self,
85            object_minimum_normalized_radius: c_float,
86        );
87
88        #[deprecated]
89        #[unsafe(method(minimumObjectSize))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn minimumObjectSize(&self) -> c_float;
92
93        /// Setter for [`minimumObjectSize`][Self::minimumObjectSize].
94        #[deprecated]
95        #[unsafe(method(setMinimumObjectSize:))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn setMinimumObjectSize(&self, minimum_object_size: c_float);
98
99        /// 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.
100        #[unsafe(method(objectMaximumNormalizedRadius))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn objectMaximumNormalizedRadius(&self) -> c_float;
103
104        /// Setter for [`objectMaximumNormalizedRadius`][Self::objectMaximumNormalizedRadius].
105        #[unsafe(method(setObjectMaximumNormalizedRadius:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn setObjectMaximumNormalizedRadius(
108            &self,
109            object_maximum_normalized_radius: c_float,
110        );
111
112        #[deprecated]
113        #[unsafe(method(maximumObjectSize))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn maximumObjectSize(&self) -> c_float;
116
117        /// Setter for [`maximumObjectSize`][Self::maximumObjectSize].
118        #[deprecated]
119        #[unsafe(method(setMaximumObjectSize:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setMaximumObjectSize(&self, maximum_object_size: c_float);
122
123        #[cfg(feature = "objc2-core-media")]
124        /// 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.
125        #[unsafe(method(targetFrameTime))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn targetFrameTime(&self) -> CMTime;
128
129        #[cfg(feature = "objc2-core-media")]
130        /// Setter for [`targetFrameTime`][Self::targetFrameTime].
131        #[unsafe(method(setTargetFrameTime:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn setTargetFrameTime(&self, target_frame_time: CMTime);
134
135        #[cfg(feature = "VNObservation")]
136        /// Provides VNTrajectoryObservation results.
137        #[unsafe(method(results))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn results(&self) -> Option<Retained<NSArray<VNTrajectoryObservation>>>;
140    );
141}
142
143/// Methods declared on superclass `VNStatefulRequest`.
144#[cfg(all(feature = "VNRequest", feature = "VNStatefulRequest"))]
145impl VNDetectTrajectoriesRequest {
146    extern_methods!(
147        #[unsafe(method(new))]
148        #[unsafe(method_family = new)]
149        pub unsafe fn new() -> Retained<Self>;
150
151        #[unsafe(method(init))]
152        #[unsafe(method_family = init)]
153        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
154
155        #[cfg(feature = "block2")]
156        #[unsafe(method(initWithCompletionHandler:))]
157        #[unsafe(method_family = init)]
158        pub unsafe fn initWithCompletionHandler(
159            this: Allocated<Self>,
160            completion_handler: VNRequestCompletionHandler,
161        ) -> Retained<Self>;
162    );
163}
164
165/// [Apple's documentation](https://developer.apple.com/documentation/vision/vndetecttrajectoriesrequestrevision1?language=objc)
166pub static VNDetectTrajectoriesRequestRevision1: NSUInteger = 1;