objc2_vision/generated/VNGenerateOpticalFlowRequest.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-graphics")]
7use objc2_core_graphics::*;
8#[cfg(feature = "objc2-core-image")]
9use objc2_core_image::*;
10#[cfg(feature = "objc2-core-media")]
11use objc2_core_media::*;
12#[cfg(feature = "objc2-core-video")]
13use objc2_core_video::*;
14use objc2_foundation::*;
15#[cfg(feature = "objc2-image-io")]
16use objc2_image_io::*;
17
18use crate::*;
19
20/// The level of optical flow computational accuracy.
21///
22/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vngenerateopticalflowrequestcomputationaccuracy?language=objc)
23// NS_ENUM
24#[repr(transparent)]
25#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
26pub struct VNGenerateOpticalFlowRequestComputationAccuracy(pub NSUInteger);
27impl VNGenerateOpticalFlowRequestComputationAccuracy {
28 #[doc(alias = "VNGenerateOpticalFlowRequestComputationAccuracyLow")]
29 pub const Low: Self = Self(0);
30 #[doc(alias = "VNGenerateOpticalFlowRequestComputationAccuracyMedium")]
31 pub const Medium: Self = Self(1);
32 #[doc(alias = "VNGenerateOpticalFlowRequestComputationAccuracyHigh")]
33 pub const High: Self = Self(2);
34 #[doc(alias = "VNGenerateOpticalFlowRequestComputationAccuracyVeryHigh")]
35 pub const VeryHigh: Self = Self(3);
36}
37
38unsafe impl Encode for VNGenerateOpticalFlowRequestComputationAccuracy {
39 const ENCODING: Encoding = NSUInteger::ENCODING;
40}
41
42unsafe impl RefEncode for VNGenerateOpticalFlowRequestComputationAccuracy {
43 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
44}
45
46extern_class!(
47 /// VNGenerateOpticalFlowRequest will determine directional change vectors for each pixel in the targeted image to transform it into the image processed
48 /// by the request handler, reporting this result with a single VNPixelBufferObservation.
49 ///
50 ///
51 /// Because this request works at the pixel level, both images must have the same dimensions in order for the request to be successfully performed.
52 /// Setting a region of interest will isolate where the change determination is performed; however, the resultant observation will still be reported
53 /// with a full resolution VNPixelBufferObservation.
54 ///
55 /// Optical flow requests are very resource intensive, so it is recommended that only one request at a time be created and that the handler
56 /// where the request was issued be released immediately after generating optical flows.
57 ///
58 /// Example usage:
59 ///
60 /// - (nullable VNPixelBufferObservation*) opticalFlowFromImage:(CVPixelBufferRef)fromImage toImage:(CVPixelBuffer)toImage error:(NSError**)error
61 /// {
62 /// VNImageRequestHandler* imageRequestHandler = [[VNImageRequestHandler alloc] initWithCVPixelBuffer:fromImage options:
63 /// @
64 /// {}];
65 /// VNGenerateOpticalFlowRequest* request = [[VNGenerateOpticalFlowRequest alloc] initWithTargetedCVPixelBuffer:toImage options:
66 /// @
67 /// {}];
68 /// if (![imageRequestHandler performRequests:
69 /// @
70 /// [ request ] error:error])
71 /// {
72 /// return nil;
73 /// }
74 ///
75 /// return [[request results] firstObject];
76 /// }
77 ///
78 /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vngenerateopticalflowrequest?language=objc)
79 #[unsafe(super(VNTargetedImageRequest, VNImageBasedRequest, VNRequest, NSObject))]
80 #[derive(Debug, PartialEq, Eq, Hash)]
81 #[cfg(all(feature = "VNRequest", feature = "VNTargetedImageRequest"))]
82 pub struct VNGenerateOpticalFlowRequest;
83);
84
85#[cfg(all(feature = "VNRequest", feature = "VNTargetedImageRequest"))]
86extern_conformance!(
87 unsafe impl NSCopying for VNGenerateOpticalFlowRequest {}
88);
89
90#[cfg(all(feature = "VNRequest", feature = "VNTargetedImageRequest"))]
91unsafe impl CopyingHelper for VNGenerateOpticalFlowRequest {
92 type Result = Self;
93}
94
95#[cfg(all(feature = "VNRequest", feature = "VNTargetedImageRequest"))]
96extern_conformance!(
97 unsafe impl NSObjectProtocol for VNGenerateOpticalFlowRequest {}
98);
99
100#[cfg(all(feature = "VNRequest", feature = "VNTargetedImageRequest"))]
101impl VNGenerateOpticalFlowRequest {
102 extern_methods!(
103 /// The level of accuracy used to compute the optical flow. Default is VNGenerateOpticalFlowRequestComputationAccuracyMedium.
104 ///
105 /// The computational time typically trends with the accuracy level. This parameter allows for selective tuning by the client application.
106 #[unsafe(method(computationAccuracy))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn computationAccuracy(&self)
109 -> VNGenerateOpticalFlowRequestComputationAccuracy;
110
111 /// Setter for [`computationAccuracy`][Self::computationAccuracy].
112 #[unsafe(method(setComputationAccuracy:))]
113 #[unsafe(method_family = none)]
114 pub unsafe fn setComputationAccuracy(
115 &self,
116 computation_accuracy: VNGenerateOpticalFlowRequestComputationAccuracy,
117 );
118
119 /// Pixel format type of the output buffer. Valid values are kCVPixelFormatType_TwoComponent32Float and kCVPixelFormatType_TwoComponent16Half.
120 /// Default is kCVPixelFormatType_TwoComponent32Float.
121 #[unsafe(method(outputPixelFormat))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn outputPixelFormat(&self) -> OSType;
124
125 /// Setter for [`outputPixelFormat`][Self::outputPixelFormat].
126 #[unsafe(method(setOutputPixelFormat:))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn setOutputPixelFormat(&self, output_pixel_format: OSType);
129
130 /// Setting this to YES will keep the raw pixel buffer coming from the the ML network. The default is NO.
131 ///
132 /// When set to YES, the outputPixelFormat is ignored. Setting this for revision 1 is a no-op as it is not ML-based.
133 #[unsafe(method(keepNetworkOutput))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn keepNetworkOutput(&self) -> bool;
136
137 /// Setter for [`keepNetworkOutput`][Self::keepNetworkOutput].
138 #[unsafe(method(setKeepNetworkOutput:))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn setKeepNetworkOutput(&self, keep_network_output: bool);
141
142 #[cfg(feature = "VNObservation")]
143 /// VNPixelBufferObservation results.
144 #[unsafe(method(results))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn results(&self) -> Option<Retained<NSArray<VNPixelBufferObservation>>>;
147 );
148}
149
150/// Methods declared on superclass `VNTargetedImageRequest`.
151#[cfg(all(feature = "VNRequest", feature = "VNTargetedImageRequest"))]
152impl VNGenerateOpticalFlowRequest {
153 extern_methods!(
154 #[unsafe(method(init))]
155 #[unsafe(method_family = init)]
156 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
157
158 #[cfg(feature = "block2")]
159 /// # Safety
160 ///
161 /// `completion_handler` must be a valid pointer or null.
162 #[unsafe(method(initWithCompletionHandler:))]
163 #[unsafe(method_family = init)]
164 pub unsafe fn initWithCompletionHandler(
165 this: Allocated<Self>,
166 completion_handler: VNRequestCompletionHandler,
167 ) -> Retained<Self>;
168
169 #[cfg(all(feature = "VNRequestHandler", feature = "objc2-core-video"))]
170 /// Create a new request that targets an image in a pixel buffer.
171 ///
172 ///
173 /// Parameter `pixelBuffer`: The pixel buffer containing the targeted image.
174 ///
175 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
176 ///
177 /// # Safety
178 ///
179 /// `options` generic should be of the correct type.
180 #[unsafe(method(initWithTargetedCVPixelBuffer:options:))]
181 #[unsafe(method_family = init)]
182 pub unsafe fn initWithTargetedCVPixelBuffer_options(
183 this: Allocated<Self>,
184 pixel_buffer: &CVPixelBuffer,
185 options: &NSDictionary<VNImageOption, AnyObject>,
186 ) -> Retained<Self>;
187
188 #[cfg(all(
189 feature = "VNRequestHandler",
190 feature = "block2",
191 feature = "objc2-core-video"
192 ))]
193 /// Create a new request that targets an image in a pixel buffer.
194 ///
195 ///
196 /// Parameter `pixelBuffer`: The pixel buffer containing the targeted image.
197 ///
198 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
199 ///
200 /// Parameter `completionHandler`: The block that is invoked when the request has been performed.
201 ///
202 /// # Safety
203 ///
204 /// - `options` generic should be of the correct type.
205 /// - `completion_handler` must be a valid pointer or null.
206 #[unsafe(method(initWithTargetedCVPixelBuffer:options:completionHandler:))]
207 #[unsafe(method_family = init)]
208 pub unsafe fn initWithTargetedCVPixelBuffer_options_completionHandler(
209 this: Allocated<Self>,
210 pixel_buffer: &CVPixelBuffer,
211 options: &NSDictionary<VNImageOption, AnyObject>,
212 completion_handler: VNRequestCompletionHandler,
213 ) -> Retained<Self>;
214
215 #[cfg(all(
216 feature = "VNRequestHandler",
217 feature = "objc2-core-video",
218 feature = "objc2-image-io"
219 ))]
220 /// Create a new request that targets an image in a pixel buffer.
221 ///
222 ///
223 /// Parameter `pixelBuffer`: The pixel buffer containing the targeted image.
224 ///
225 /// Parameter `orientation`: The orientation of the image/buffer based on the EXIF specification. For details see kCGImagePropertyOrientation. The value has to be an integer from 1 to 8. This supersedes every other orientation information.
226 ///
227 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
228 ///
229 /// # Safety
230 ///
231 /// `options` generic should be of the correct type.
232 #[unsafe(method(initWithTargetedCVPixelBuffer:orientation:options:))]
233 #[unsafe(method_family = init)]
234 pub unsafe fn initWithTargetedCVPixelBuffer_orientation_options(
235 this: Allocated<Self>,
236 pixel_buffer: &CVPixelBuffer,
237 orientation: CGImagePropertyOrientation,
238 options: &NSDictionary<VNImageOption, AnyObject>,
239 ) -> Retained<Self>;
240
241 #[cfg(all(
242 feature = "VNRequestHandler",
243 feature = "block2",
244 feature = "objc2-core-video",
245 feature = "objc2-image-io"
246 ))]
247 /// Create a new request that targets an image in a pixel buffer.
248 ///
249 ///
250 /// Parameter `pixelBuffer`: The pixel buffer containing the targeted image.
251 ///
252 /// Parameter `orientation`: The orientation of the image/buffer based on the EXIF specification. For details see kCGImagePropertyOrientation. The value has to be an integer from 1 to 8. This supersedes every other orientation information.
253 ///
254 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
255 ///
256 /// Parameter `completionHandler`: The block that is invoked when the request has been performed.
257 ///
258 /// # Safety
259 ///
260 /// - `options` generic should be of the correct type.
261 /// - `completion_handler` must be a valid pointer or null.
262 #[unsafe(method(initWithTargetedCVPixelBuffer:orientation:options:completionHandler:))]
263 #[unsafe(method_family = init)]
264 pub unsafe fn initWithTargetedCVPixelBuffer_orientation_options_completionHandler(
265 this: Allocated<Self>,
266 pixel_buffer: &CVPixelBuffer,
267 orientation: CGImagePropertyOrientation,
268 options: &NSDictionary<VNImageOption, AnyObject>,
269 completion_handler: VNRequestCompletionHandler,
270 ) -> Retained<Self>;
271
272 #[cfg(all(feature = "VNRequestHandler", feature = "objc2-core-graphics"))]
273 /// Create a new request with a targeted CGImage.
274 ///
275 ///
276 /// Parameter `cgImage`: The CGImageRef of the targeted image.
277 ///
278 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
279 ///
280 /// # Safety
281 ///
282 /// `options` generic should be of the correct type.
283 #[unsafe(method(initWithTargetedCGImage:options:))]
284 #[unsafe(method_family = init)]
285 pub unsafe fn initWithTargetedCGImage_options(
286 this: Allocated<Self>,
287 cg_image: &CGImage,
288 options: &NSDictionary<VNImageOption, AnyObject>,
289 ) -> Retained<Self>;
290
291 #[cfg(all(
292 feature = "VNRequestHandler",
293 feature = "block2",
294 feature = "objc2-core-graphics"
295 ))]
296 /// Create a new request with a targeted CGImage.
297 ///
298 ///
299 /// Parameter `cgImage`: The CGImageRef of the targeted image.
300 ///
301 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
302 ///
303 /// Parameter `completionHandler`: The block that is invoked when the request has been performed.
304 ///
305 /// # Safety
306 ///
307 /// - `options` generic should be of the correct type.
308 /// - `completion_handler` must be a valid pointer or null.
309 #[unsafe(method(initWithTargetedCGImage:options:completionHandler:))]
310 #[unsafe(method_family = init)]
311 pub unsafe fn initWithTargetedCGImage_options_completionHandler(
312 this: Allocated<Self>,
313 cg_image: &CGImage,
314 options: &NSDictionary<VNImageOption, AnyObject>,
315 completion_handler: VNRequestCompletionHandler,
316 ) -> Retained<Self>;
317
318 #[cfg(all(
319 feature = "VNRequestHandler",
320 feature = "objc2-core-graphics",
321 feature = "objc2-image-io"
322 ))]
323 /// Create a new request with a targeted CGImage.
324 ///
325 ///
326 /// Parameter `cgImage`: The CGImageRef of the targeted image.
327 ///
328 /// Parameter `orientation`: The orientation of the image/buffer based on the EXIF specification. For details see kCGImagePropertyOrientation. The value has to be an integer from 1 to 8. This supersedes every other orientation information.
329 ///
330 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
331 ///
332 /// # Safety
333 ///
334 /// `options` generic should be of the correct type.
335 #[unsafe(method(initWithTargetedCGImage:orientation:options:))]
336 #[unsafe(method_family = init)]
337 pub unsafe fn initWithTargetedCGImage_orientation_options(
338 this: Allocated<Self>,
339 cg_image: &CGImage,
340 orientation: CGImagePropertyOrientation,
341 options: &NSDictionary<VNImageOption, AnyObject>,
342 ) -> Retained<Self>;
343
344 #[cfg(all(
345 feature = "VNRequestHandler",
346 feature = "block2",
347 feature = "objc2-core-graphics",
348 feature = "objc2-image-io"
349 ))]
350 /// Create a new request with a targeted CGImage.
351 ///
352 ///
353 /// Parameter `cgImage`: The CGImageRef of the targeted image.
354 ///
355 /// Parameter `orientation`: The orientation of the image/buffer based on the EXIF specification. For details see kCGImagePropertyOrientation. The value has to be an integer from 1 to 8. This supersedes every other orientation information.
356 ///
357 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
358 ///
359 /// Parameter `completionHandler`: The block that is invoked when the request has been performed.
360 ///
361 /// # Safety
362 ///
363 /// - `options` generic should be of the correct type.
364 /// - `completion_handler` must be a valid pointer or null.
365 #[unsafe(method(initWithTargetedCGImage:orientation:options:completionHandler:))]
366 #[unsafe(method_family = init)]
367 pub unsafe fn initWithTargetedCGImage_orientation_options_completionHandler(
368 this: Allocated<Self>,
369 cg_image: &CGImage,
370 orientation: CGImagePropertyOrientation,
371 options: &NSDictionary<VNImageOption, AnyObject>,
372 completion_handler: VNRequestCompletionHandler,
373 ) -> Retained<Self>;
374
375 #[cfg(all(feature = "VNRequestHandler", feature = "objc2-core-image"))]
376 /// Create a new request with a targeted CIImage.
377 ///
378 ///
379 /// Parameter `ciImage`: The CIImage of the targeted image.
380 ///
381 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
382 ///
383 /// # Safety
384 ///
385 /// `options` generic should be of the correct type.
386 #[unsafe(method(initWithTargetedCIImage:options:))]
387 #[unsafe(method_family = init)]
388 pub unsafe fn initWithTargetedCIImage_options(
389 this: Allocated<Self>,
390 ci_image: &CIImage,
391 options: &NSDictionary<VNImageOption, AnyObject>,
392 ) -> Retained<Self>;
393
394 #[cfg(all(
395 feature = "VNRequestHandler",
396 feature = "block2",
397 feature = "objc2-core-image"
398 ))]
399 /// Create a new request with a targeted CIImage.
400 ///
401 ///
402 /// Parameter `ciImage`: The CIImage of the targeted image.
403 ///
404 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
405 ///
406 /// Parameter `completionHandler`: The block that is invoked when the request has been performed.
407 ///
408 /// # Safety
409 ///
410 /// - `options` generic should be of the correct type.
411 /// - `completion_handler` must be a valid pointer or null.
412 #[unsafe(method(initWithTargetedCIImage:options:completionHandler:))]
413 #[unsafe(method_family = init)]
414 pub unsafe fn initWithTargetedCIImage_options_completionHandler(
415 this: Allocated<Self>,
416 ci_image: &CIImage,
417 options: &NSDictionary<VNImageOption, AnyObject>,
418 completion_handler: VNRequestCompletionHandler,
419 ) -> Retained<Self>;
420
421 #[cfg(all(
422 feature = "VNRequestHandler",
423 feature = "objc2-core-image",
424 feature = "objc2-image-io"
425 ))]
426 /// Create a new request with a targeted CIImage.
427 ///
428 ///
429 /// Parameter `ciImage`: The CIImage of the targeted image.
430 ///
431 /// Parameter `orientation`: The orientation of the image/buffer based on the EXIF specification. For details see kCGImagePropertyOrientation. The value has to be an integer from 1 to 8. This supersedes every other orientation information.
432 ///
433 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
434 ///
435 /// # Safety
436 ///
437 /// `options` generic should be of the correct type.
438 #[unsafe(method(initWithTargetedCIImage:orientation:options:))]
439 #[unsafe(method_family = init)]
440 pub unsafe fn initWithTargetedCIImage_orientation_options(
441 this: Allocated<Self>,
442 ci_image: &CIImage,
443 orientation: CGImagePropertyOrientation,
444 options: &NSDictionary<VNImageOption, AnyObject>,
445 ) -> Retained<Self>;
446
447 #[cfg(all(
448 feature = "VNRequestHandler",
449 feature = "block2",
450 feature = "objc2-core-image",
451 feature = "objc2-image-io"
452 ))]
453 /// Create a new request with a targeted CIImage.
454 ///
455 ///
456 /// Parameter `ciImage`: The CIImage of the targeted image.
457 ///
458 /// Parameter `orientation`: The orientation of the image/buffer based on the EXIF specification. For details see kCGImagePropertyOrientation. The value has to be an integer from 1 to 8. This supersedes every other orientation information.
459 ///
460 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
461 ///
462 /// Parameter `completionHandler`: The block that is invoked when the request has been performed.
463 ///
464 /// # Safety
465 ///
466 /// - `options` generic should be of the correct type.
467 /// - `completion_handler` must be a valid pointer or null.
468 #[unsafe(method(initWithTargetedCIImage:orientation:options:completionHandler:))]
469 #[unsafe(method_family = init)]
470 pub unsafe fn initWithTargetedCIImage_orientation_options_completionHandler(
471 this: Allocated<Self>,
472 ci_image: &CIImage,
473 orientation: CGImagePropertyOrientation,
474 options: &NSDictionary<VNImageOption, AnyObject>,
475 completion_handler: VNRequestCompletionHandler,
476 ) -> Retained<Self>;
477
478 #[cfg(feature = "VNRequestHandler")]
479 /// Create a new request with a targeted image URL.
480 ///
481 ///
482 /// Parameter `imageURL`: The URL of the targeted image.
483 ///
484 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
485 ///
486 /// # Safety
487 ///
488 /// `options` generic should be of the correct type.
489 #[unsafe(method(initWithTargetedImageURL:options:))]
490 #[unsafe(method_family = init)]
491 pub unsafe fn initWithTargetedImageURL_options(
492 this: Allocated<Self>,
493 image_url: &NSURL,
494 options: &NSDictionary<VNImageOption, AnyObject>,
495 ) -> Retained<Self>;
496
497 #[cfg(all(feature = "VNRequestHandler", feature = "block2"))]
498 /// Create a new request with a targeted image URL.
499 ///
500 ///
501 /// Parameter `imageURL`: The URL of the targeted image.
502 ///
503 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
504 ///
505 /// Parameter `completionHandler`: The block that is invoked when the request has been performed.
506 ///
507 /// # Safety
508 ///
509 /// - `options` generic should be of the correct type.
510 /// - `completion_handler` must be a valid pointer or null.
511 #[unsafe(method(initWithTargetedImageURL:options:completionHandler:))]
512 #[unsafe(method_family = init)]
513 pub unsafe fn initWithTargetedImageURL_options_completionHandler(
514 this: Allocated<Self>,
515 image_url: &NSURL,
516 options: &NSDictionary<VNImageOption, AnyObject>,
517 completion_handler: VNRequestCompletionHandler,
518 ) -> Retained<Self>;
519
520 #[cfg(all(feature = "VNRequestHandler", feature = "objc2-image-io"))]
521 /// Create a new request with a targeted image URL.
522 ///
523 ///
524 /// Parameter `imageURL`: The URL of the targeted image.
525 ///
526 /// Parameter `orientation`: The orientation of the image/buffer based on the EXIF specification. For details see kCGImagePropertyOrientation. The value has to be an integer from 1 to 8. This supersedes every other orientation information.
527 ///
528 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
529 ///
530 /// # Safety
531 ///
532 /// `options` generic should be of the correct type.
533 #[unsafe(method(initWithTargetedImageURL:orientation:options:))]
534 #[unsafe(method_family = init)]
535 pub unsafe fn initWithTargetedImageURL_orientation_options(
536 this: Allocated<Self>,
537 image_url: &NSURL,
538 orientation: CGImagePropertyOrientation,
539 options: &NSDictionary<VNImageOption, AnyObject>,
540 ) -> Retained<Self>;
541
542 #[cfg(all(
543 feature = "VNRequestHandler",
544 feature = "block2",
545 feature = "objc2-image-io"
546 ))]
547 /// Create a new request with a targeted image URL.
548 ///
549 ///
550 /// Parameter `imageURL`: The URL of the targeted image.
551 ///
552 /// Parameter `orientation`: The orientation of the image/buffer based on the EXIF specification. For details see kCGImagePropertyOrientation. The value has to be an integer from 1 to 8. This supersedes every other orientation information.
553 ///
554 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
555 ///
556 /// Parameter `completionHandler`: The block that is invoked when the request has been performed.
557 ///
558 /// # Safety
559 ///
560 /// - `options` generic should be of the correct type.
561 /// - `completion_handler` must be a valid pointer or null.
562 #[unsafe(method(initWithTargetedImageURL:orientation:options:completionHandler:))]
563 #[unsafe(method_family = init)]
564 pub unsafe fn initWithTargetedImageURL_orientation_options_completionHandler(
565 this: Allocated<Self>,
566 image_url: &NSURL,
567 orientation: CGImagePropertyOrientation,
568 options: &NSDictionary<VNImageOption, AnyObject>,
569 completion_handler: VNRequestCompletionHandler,
570 ) -> Retained<Self>;
571
572 #[cfg(feature = "VNRequestHandler")]
573 /// Create a new request with a targeted image data.
574 ///
575 ///
576 /// Parameter `imageData`: The data of the targeted image.
577 ///
578 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
579 ///
580 /// # Safety
581 ///
582 /// `options` generic should be of the correct type.
583 #[unsafe(method(initWithTargetedImageData:options:))]
584 #[unsafe(method_family = init)]
585 pub unsafe fn initWithTargetedImageData_options(
586 this: Allocated<Self>,
587 image_data: &NSData,
588 options: &NSDictionary<VNImageOption, AnyObject>,
589 ) -> Retained<Self>;
590
591 #[cfg(all(feature = "VNRequestHandler", feature = "block2"))]
592 /// Create a new request with a targeted image data.
593 ///
594 ///
595 /// Parameter `imageData`: The data of the targeted image.
596 ///
597 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
598 ///
599 /// Parameter `completionHandler`: The block that is invoked when the request has been performed.
600 ///
601 /// # Safety
602 ///
603 /// - `options` generic should be of the correct type.
604 /// - `completion_handler` must be a valid pointer or null.
605 #[unsafe(method(initWithTargetedImageData:options:completionHandler:))]
606 #[unsafe(method_family = init)]
607 pub unsafe fn initWithTargetedImageData_options_completionHandler(
608 this: Allocated<Self>,
609 image_data: &NSData,
610 options: &NSDictionary<VNImageOption, AnyObject>,
611 completion_handler: VNRequestCompletionHandler,
612 ) -> Retained<Self>;
613
614 #[cfg(all(feature = "VNRequestHandler", feature = "objc2-image-io"))]
615 /// Create a new request with a targeted image data.
616 ///
617 ///
618 /// Parameter `imageData`: The data of the targeted image.
619 ///
620 /// Parameter `orientation`: The orientation of the image/buffer based on the EXIF specification. For details see kCGImagePropertyOrientation. The value has to be an integer from 1 to 8. This supersedes every other orientation information.
621 ///
622 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
623 ///
624 /// # Safety
625 ///
626 /// `options` generic should be of the correct type.
627 #[unsafe(method(initWithTargetedImageData:orientation:options:))]
628 #[unsafe(method_family = init)]
629 pub unsafe fn initWithTargetedImageData_orientation_options(
630 this: Allocated<Self>,
631 image_data: &NSData,
632 orientation: CGImagePropertyOrientation,
633 options: &NSDictionary<VNImageOption, AnyObject>,
634 ) -> Retained<Self>;
635
636 #[cfg(all(
637 feature = "VNRequestHandler",
638 feature = "block2",
639 feature = "objc2-image-io"
640 ))]
641 /// Create a new request with a targeted image data.
642 ///
643 ///
644 /// Parameter `imageData`: The data of the targeted image.
645 ///
646 /// Parameter `orientation`: The orientation of the image/buffer based on the EXIF specification. For details see kCGImagePropertyOrientation. The value has to be an integer from 1 to 8. This supersedes every other orientation information.
647 ///
648 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
649 ///
650 /// Parameter `completionHandler`: The block that is invoked when the request has been performed.
651 ///
652 /// # Safety
653 ///
654 /// - `options` generic should be of the correct type.
655 /// - `completion_handler` must be a valid pointer or null.
656 #[unsafe(method(initWithTargetedImageData:orientation:options:completionHandler:))]
657 #[unsafe(method_family = init)]
658 pub unsafe fn initWithTargetedImageData_orientation_options_completionHandler(
659 this: Allocated<Self>,
660 image_data: &NSData,
661 orientation: CGImagePropertyOrientation,
662 options: &NSDictionary<VNImageOption, AnyObject>,
663 completion_handler: VNRequestCompletionHandler,
664 ) -> Retained<Self>;
665
666 #[cfg(all(feature = "VNRequestHandler", feature = "objc2-core-media"))]
667 /// Create a new request with a targeted CMSampleBuffer.
668 ///
669 ///
670 /// Parameter `sampleBuffer`: The CMSampleBuffer containing the CVImageBuffer to be used by the request.
671 ///
672 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
673 ///
674 /// # Safety
675 ///
676 /// `options` generic should be of the correct type.
677 #[unsafe(method(initWithTargetedCMSampleBuffer:options:))]
678 #[unsafe(method_family = init)]
679 pub unsafe fn initWithTargetedCMSampleBuffer_options(
680 this: Allocated<Self>,
681 sample_buffer: &CMSampleBuffer,
682 options: &NSDictionary<VNImageOption, AnyObject>,
683 ) -> Retained<Self>;
684
685 #[cfg(all(
686 feature = "VNRequestHandler",
687 feature = "block2",
688 feature = "objc2-core-media"
689 ))]
690 /// Create a new request with a targeted CMSampleBuffer.
691 ///
692 ///
693 /// Parameter `sampleBuffer`: The CMSampleBuffer containing the CVImageBuffer to be used by the request.
694 ///
695 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
696 ///
697 /// Parameter `completionHandler`: The block that is invoked after the request has been performed.
698 ///
699 /// # Safety
700 ///
701 /// - `options` generic should be of the correct type.
702 /// - `completion_handler` must be a valid pointer or null.
703 #[unsafe(method(initWithTargetedCMSampleBuffer:options:completionHandler:))]
704 #[unsafe(method_family = init)]
705 pub unsafe fn initWithTargetedCMSampleBuffer_options_completionHandler(
706 this: Allocated<Self>,
707 sample_buffer: &CMSampleBuffer,
708 options: &NSDictionary<VNImageOption, AnyObject>,
709 completion_handler: VNRequestCompletionHandler,
710 ) -> Retained<Self>;
711
712 #[cfg(all(
713 feature = "VNRequestHandler",
714 feature = "objc2-core-media",
715 feature = "objc2-image-io"
716 ))]
717 /// Create a new request with a targeted CMSampleBuffer.
718 ///
719 ///
720 /// Parameter `sampleBuffer`: The CMSampleBuffer containing the CVImageBuffer to be used by the request.
721 ///
722 /// Parameter `orientation`: The orientation of the image/buffer based on the EXIF specification. For details see kCGImagePropertyOrientation. The value has to be an integer from 1 to 8. This supersedes every other orientation information.
723 ///
724 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
725 ///
726 /// # Safety
727 ///
728 /// `options` generic should be of the correct type.
729 #[unsafe(method(initWithTargetedCMSampleBuffer:orientation:options:))]
730 #[unsafe(method_family = init)]
731 pub unsafe fn initWithTargetedCMSampleBuffer_orientation_options(
732 this: Allocated<Self>,
733 sample_buffer: &CMSampleBuffer,
734 orientation: CGImagePropertyOrientation,
735 options: &NSDictionary<VNImageOption, AnyObject>,
736 ) -> Retained<Self>;
737
738 #[cfg(all(
739 feature = "VNRequestHandler",
740 feature = "block2",
741 feature = "objc2-core-media",
742 feature = "objc2-image-io"
743 ))]
744 /// Create a new request with a targeted CMSampleBuffer.
745 ///
746 ///
747 /// Parameter `sampleBuffer`: The CMSampleBuffer containing the CVImageBuffer to be used by the request.
748 ///
749 /// Parameter `orientation`: The orientation of the image/buffer based on the EXIF specification. For details see kCGImagePropertyOrientation. The value has to be an integer from 1 to 8. This supersedes every other orientation information.
750 ///
751 /// Parameter `options`: A dictionary with options specifying auxiliary information for the image.
752 ///
753 /// Parameter `completionHandler`: The block that is invoked after the request has been performed.
754 ///
755 /// # Safety
756 ///
757 /// - `options` generic should be of the correct type.
758 /// - `completion_handler` must be a valid pointer or null.
759 #[unsafe(method(initWithTargetedCMSampleBuffer:orientation:options:completionHandler:))]
760 #[unsafe(method_family = init)]
761 pub unsafe fn initWithTargetedCMSampleBuffer_orientation_options_completionHandler(
762 this: Allocated<Self>,
763 sample_buffer: &CMSampleBuffer,
764 orientation: CGImagePropertyOrientation,
765 options: &NSDictionary<VNImageOption, AnyObject>,
766 completion_handler: VNRequestCompletionHandler,
767 ) -> Retained<Self>;
768 );
769}
770
771/// Methods declared on superclass `NSObject`.
772#[cfg(all(feature = "VNRequest", feature = "VNTargetedImageRequest"))]
773impl VNGenerateOpticalFlowRequest {
774 extern_methods!(
775 #[unsafe(method(new))]
776 #[unsafe(method_family = new)]
777 pub unsafe fn new() -> Retained<Self>;
778 );
779}
780
781/// [Apple's documentation](https://developer.apple.com/documentation/vision/vngenerateopticalflowrequestrevision1?language=objc)
782pub static VNGenerateOpticalFlowRequestRevision1: NSUInteger = 1;
783
784/// [Apple's documentation](https://developer.apple.com/documentation/vision/vngenerateopticalflowrequestrevision2?language=objc)
785pub static VNGenerateOpticalFlowRequestRevision2: NSUInteger = 2;