objc2_vision/generated/VNRequestHandler.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-av-foundation")]
6use objc2_av_foundation::*;
7#[cfg(feature = "objc2-core-graphics")]
8use objc2_core_graphics::*;
9#[cfg(feature = "objc2-core-image")]
10use objc2_core_image::*;
11#[cfg(feature = "objc2-core-media")]
12use objc2_core_media::*;
13#[cfg(feature = "objc2-core-video")]
14use objc2_core_video::*;
15use objc2_foundation::*;
16#[cfg(feature = "objc2-image-io")]
17use objc2_image_io::*;
18
19use crate::*;
20
21/// Options keys passed into the VNImageRequestHandler creations or requests that take an auxiliary image. These are options that either describe specific properties of an image like the VNImageOptionCameraIntrinsics or how an image needs to be handled like the VNImageOptionCIContext.
22///
23/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnimageoption?language=objc)
24// NS_TYPED_ENUM
25pub type VNImageOption = NSString;
26
27extern "C" {
28 /// VNImageOptionProperties is the dictionary from CGImageSourceCopyPropertiesAtIndex. This contains metadata that can be used by some algorithms like horizon detection.
29 ///
30 /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnimageoptionproperties?language=objc)
31 pub static VNImageOptionProperties: &'static VNImageOption;
32}
33
34extern "C" {
35 /// VNImageOptionCameraIntrinsics Specifies the camera intrinsics as an NSData or CFData representing a matrix_float3x3. See kCMSampleBufferAttachmentKey_CameraIntrinsicMatrix for details
36 ///
37 /// Camera intrinsic matrix is a CFData containing a matrix_float3x3, which is column-major. It has the following contents:
38 /// fx 0 ox
39 /// 0 fy oy
40 /// 0 0 1
41 /// fx and fy are the focal length in pixels. For square pixels, they will have the same value.
42 /// ox and oy are the coordinates of the principal point. The origin is the upper left of the frame.
43 ///
44 /// Note: When using a CMSampleBuffer as an input and that sample buffer has camera intrinsics attached to it, Vision will use the camera intrinsic from there unless overwritten by passing in as an explicit option which will take precedence.
45 ///
46 /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnimageoptioncameraintrinsics?language=objc)
47 pub static VNImageOptionCameraIntrinsics: &'static VNImageOption;
48}
49
50extern "C" {
51 /// VNImageOptionCIContext Specifies the CIContext to be used in Core Image operations of request handler. If this is not specified, Vision will create its own CIContext. This option is helpful when the passed in CIImage is the result of a CIFilter chain that has been executed on a CIContext or uses outputs of a CIImage on a given CIContext as they don't have to transfer to other contexts.
52 ///
53 /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnimageoptioncicontext?language=objc)
54 pub static VNImageOptionCIContext: &'static VNImageOption;
55}
56
57extern_class!(
58 /// Performs requests on a single image.
59 ///
60 /// The VNImageRequestHandler is created with an image that is used to be used for the requests a client might want to schedule. The VNImageRequestHandler retains, but never modifies, the image source for its entire lifetime. The client also must not modify the content of the image source once the VNImageRequestHandler is created otherwise the results are undefined.
61 /// The VNImageRequestHandler can choose to also cache intermediate representation of the image or other request-specific information for the purposes of runtime performance.
62 ///
63 /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnimagerequesthandler?language=objc)
64 #[unsafe(super(NSObject))]
65 #[derive(Debug, PartialEq, Eq, Hash)]
66 pub struct VNImageRequestHandler;
67);
68
69extern_conformance!(
70 unsafe impl NSObjectProtocol for VNImageRequestHandler {}
71);
72
73impl VNImageRequestHandler {
74 extern_methods!(
75 #[unsafe(method(init))]
76 #[unsafe(method_family = init)]
77 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
78
79 #[cfg(feature = "objc2-core-video")]
80 /// initWithCVPixelBuffer:options creates a VNImageRequestHandler to be used for performing requests against the image passed in as buffer.
81 ///
82 ///
83 /// Parameter `pixelBuffer`: A CVPixelBuffer containing the image to be used for performing the requests. The content of the buffer cannot be modified for the lifetime of the VNImageRequestHandler.
84 ///
85 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image like VNImageOptionCameraIntrinsics
86 ///
87 /// # Safety
88 ///
89 /// `options` generic should be of the correct type.
90 #[unsafe(method(initWithCVPixelBuffer:options:))]
91 #[unsafe(method_family = init)]
92 pub unsafe fn initWithCVPixelBuffer_options(
93 this: Allocated<Self>,
94 pixel_buffer: &CVPixelBuffer,
95 options: &NSDictionary<VNImageOption, AnyObject>,
96 ) -> Retained<Self>;
97
98 #[cfg(all(feature = "objc2-core-video", feature = "objc2-image-io"))]
99 /// initWithCVPixelBuffer:options creates a VNImageRequestHandler to be used for performing requests against the image passed in as buffer.
100 ///
101 ///
102 /// Parameter `pixelBuffer`: A CVPixelBuffer containing the image to be used for performing the requests. The content of the buffer cannot be modified for the lifetime of the VNImageRequestHandler.
103 ///
104 /// 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.
105 ///
106 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image like VNImageOptionCameraIntrinsics
107 ///
108 /// # Safety
109 ///
110 /// `options` generic should be of the correct type.
111 #[unsafe(method(initWithCVPixelBuffer:orientation:options:))]
112 #[unsafe(method_family = init)]
113 pub unsafe fn initWithCVPixelBuffer_orientation_options(
114 this: Allocated<Self>,
115 pixel_buffer: &CVPixelBuffer,
116 orientation: CGImagePropertyOrientation,
117 options: &NSDictionary<VNImageOption, AnyObject>,
118 ) -> Retained<Self>;
119
120 #[cfg(all(
121 feature = "objc2-av-foundation",
122 feature = "objc2-core-video",
123 feature = "objc2-image-io"
124 ))]
125 /// initWithCVPixelBuffer:depthData:orientation:options creates a VNImageRequestHandler to be used for performing requests against the image passed in as buffer with depth information.
126 ///
127 /// Parameter `pixelBuffer`: A CVPixelBuffer containing the image to be used for performing the requests. The content of the buffer cannot be modified for the lifetime of the VNImageRequestHandler.
128 ///
129 /// Parameter `depthData`: An AVDepthData instance associated with the pixelBuffer
130 ///
131 /// Parameter `orientation`: The orientation of the image and depth buffers 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 and should match for both buffers.
132 ///
133 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image
134 ///
135 /// # Safety
136 ///
137 /// `options` generic should be of the correct type.
138 #[unsafe(method(initWithCVPixelBuffer:depthData:orientation:options:))]
139 #[unsafe(method_family = init)]
140 pub unsafe fn initWithCVPixelBuffer_depthData_orientation_options(
141 this: Allocated<Self>,
142 pixel_buffer: &CVPixelBuffer,
143 depth_data: &AVDepthData,
144 orientation: CGImagePropertyOrientation,
145 options: &NSDictionary<VNImageOption, AnyObject>,
146 ) -> Retained<Self>;
147
148 #[cfg(feature = "objc2-core-graphics")]
149 /// initWithCGImage:options creates a VNImageRequestHandler to be used for performing requests against the image passed in as a CGImageRef.
150 ///
151 ///
152 /// Parameter `image`: A CGImageRef containing the image to be used for performing the requests. The content of the image cannot be modified.
153 ///
154 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image like VNImageOptionCameraIntrinsics
155 ///
156 /// # Safety
157 ///
158 /// `options` generic should be of the correct type.
159 #[unsafe(method(initWithCGImage:options:))]
160 #[unsafe(method_family = init)]
161 pub unsafe fn initWithCGImage_options(
162 this: Allocated<Self>,
163 image: &CGImage,
164 options: &NSDictionary<VNImageOption, AnyObject>,
165 ) -> Retained<Self>;
166
167 #[cfg(all(feature = "objc2-core-graphics", feature = "objc2-image-io"))]
168 /// initWithCGImage:options creates a VNImageRequestHandler to be used for performing requests against the image passed in as a CGImageRef.
169 ///
170 ///
171 /// Parameter `image`: A CGImageRef containing the image to be used for performing the requests. The content of the image cannot be modified.
172 ///
173 /// 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.
174 ///
175 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image like VNImageOptionCameraIntrinsics
176 ///
177 /// # Safety
178 ///
179 /// `options` generic should be of the correct type.
180 #[unsafe(method(initWithCGImage:orientation:options:))]
181 #[unsafe(method_family = init)]
182 pub unsafe fn initWithCGImage_orientation_options(
183 this: Allocated<Self>,
184 image: &CGImage,
185 orientation: CGImagePropertyOrientation,
186 options: &NSDictionary<VNImageOption, AnyObject>,
187 ) -> Retained<Self>;
188
189 #[cfg(feature = "objc2-core-image")]
190 /// initWithCIImage:options creates a VNImageRequestHandler to be used for performing requests against the image passed in as a CIImage.
191 ///
192 ///
193 /// Parameter `image`: A CIImage containing the image to be used for performing the requests. The content of the image cannot be modified.
194 ///
195 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image like VNImageOptionCameraIntrinsics
196 ///
197 ///
198 /// Note: : Request results may not be accurate in simulator due to CI's inability to render certain pixel formats in the simulator. The orientation of the original image should be applied for instance by using imageByApplyingOrientation or use the initWithCIImage:options:orientation API.
199 ///
200 /// # Safety
201 ///
202 /// `options` generic should be of the correct type.
203 #[unsafe(method(initWithCIImage:options:))]
204 #[unsafe(method_family = init)]
205 pub unsafe fn initWithCIImage_options(
206 this: Allocated<Self>,
207 image: &CIImage,
208 options: &NSDictionary<VNImageOption, AnyObject>,
209 ) -> Retained<Self>;
210
211 #[cfg(all(feature = "objc2-core-image", feature = "objc2-image-io"))]
212 /// initWithCIImage:options:orientation creates a VNImageRequestHandler to be used for performing requests against the image passed in as a CIImage.
213 ///
214 ///
215 /// Parameter `image`: A CIImage containing the image to be used for performing the requests. The content of the image cannot be modified.
216 ///
217 /// 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.
218 ///
219 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image like VNImageOptionCameraIntrinsics
220 ///
221 ///
222 /// Note: : Request results may not be accurate in simulator due to CI's inability to render certain pixel formats in the simulator
223 ///
224 /// # Safety
225 ///
226 /// `options` generic should be of the correct type.
227 #[unsafe(method(initWithCIImage:orientation:options:))]
228 #[unsafe(method_family = init)]
229 pub unsafe fn initWithCIImage_orientation_options(
230 this: Allocated<Self>,
231 image: &CIImage,
232 orientation: CGImagePropertyOrientation,
233 options: &NSDictionary<VNImageOption, AnyObject>,
234 ) -> Retained<Self>;
235
236 /// initWithURL:options creates a VNImageRequestHandler to be used for performing requests against an image specified by it's URL
237 ///
238 ///
239 /// Parameter `imageURL`: A URL pointing at an image to be used for performing the requests. The image has to be in a format that is supported by ImageIO. The content of the image cannot be modified.
240 ///
241 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image like VNImageOptionCameraIntrinsics
242 ///
243 ///
244 /// Note: : Request results may not be accurate in simulator due to CI's inability to render certain pixel formats in the simulator
245 ///
246 /// # Safety
247 ///
248 /// `options` generic should be of the correct type.
249 #[unsafe(method(initWithURL:options:))]
250 #[unsafe(method_family = init)]
251 pub unsafe fn initWithURL_options(
252 this: Allocated<Self>,
253 image_url: &NSURL,
254 options: &NSDictionary<VNImageOption, AnyObject>,
255 ) -> Retained<Self>;
256
257 #[cfg(feature = "objc2-image-io")]
258 /// initWithURL:options creates a VNImageRequestHandler to be used for performing requests against an image specified by it's URL
259 ///
260 ///
261 /// Parameter `imageURL`: A URL pointing at an image to be used for performing the requests. The image has to be in a format that is supported by ImageIO. The content of the image cannot be modified.
262 ///
263 /// 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.
264 ///
265 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image like VNImageOptionCameraIntrinsics
266 ///
267 ///
268 /// Note: : Request results may not be accurate in simulator due to CI's inability to render certain pixel formats in the simulator
269 ///
270 /// # Safety
271 ///
272 /// `options` generic should be of the correct type.
273 #[unsafe(method(initWithURL:orientation:options:))]
274 #[unsafe(method_family = init)]
275 pub unsafe fn initWithURL_orientation_options(
276 this: Allocated<Self>,
277 image_url: &NSURL,
278 orientation: CGImagePropertyOrientation,
279 options: &NSDictionary<VNImageOption, AnyObject>,
280 ) -> Retained<Self>;
281
282 /// initWithData:options creates a VNImageRequestHandler to be used for performing requests against an image contained in an NSData object.
283 ///
284 ///
285 /// Parameter `imageData`: An NSData object containing the content of the image to be used for performing the requests. See CIImage imageWithData for supported format. The content of the image cannot be modified.
286 ///
287 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image like VNImageOptionCameraIntrinsics
288 ///
289 ///
290 /// Note: : Request results may not be accurate in simulator due to CI's inability to render certain pixel formats in the simulator
291 #[unsafe(method(initWithData:options:))]
292 #[unsafe(method_family = init)]
293 pub fn initWithData_options(
294 this: Allocated<Self>,
295 image_data: &NSData,
296 options: &NSDictionary<VNImageOption, AnyObject>,
297 ) -> Retained<Self>;
298
299 #[cfg(feature = "objc2-image-io")]
300 /// initWithData:options creates a VNImageRequestHandler to be used for performing requests against an image contained in an NSData object.
301 ///
302 ///
303 /// Parameter `imageData`: An NSData object containing the content of the image to be used for performing the requests. See CIImage imageWithData for supported format. The content of the image cannot be modified.
304 ///
305 /// 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.
306 ///
307 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image like VNImageOptionCameraIntrinsics
308 ///
309 ///
310 /// Note: : Request results may not be accurate in simulator due to CI's inability to render certain pixel formats in the simulator
311 ///
312 /// # Safety
313 ///
314 /// `options` generic should be of the correct type.
315 #[unsafe(method(initWithData:orientation:options:))]
316 #[unsafe(method_family = init)]
317 pub unsafe fn initWithData_orientation_options(
318 this: Allocated<Self>,
319 image_data: &NSData,
320 orientation: CGImagePropertyOrientation,
321 options: &NSDictionary<VNImageOption, AnyObject>,
322 ) -> Retained<Self>;
323
324 #[cfg(feature = "objc2-core-media")]
325 /// Creates a VNImageRequestHandler to be used for performing requests against the image buffer contained in the CMSampleBufferRef
326 ///
327 ///
328 /// Parameter `sampleBuffer`: A CMSampleBuffer containing the imageBuffer that will be used for performing the requests. Not all types of sample buffers are supported. They need to contain a CVImageBuffer, be valid and ready.
329 ///
330 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image like VNImageOptionCameraIntrinsics
331 ///
332 /// Note: CMSampleBuffers can contain metadata like camera intrinsics that will be used by algorithms supporting it unless overwritten by the options.
333 ///
334 /// # Safety
335 ///
336 /// `options` generic should be of the correct type.
337 #[unsafe(method(initWithCMSampleBuffer:options:))]
338 #[unsafe(method_family = init)]
339 pub unsafe fn initWithCMSampleBuffer_options(
340 this: Allocated<Self>,
341 sample_buffer: &CMSampleBuffer,
342 options: &NSDictionary<VNImageOption, AnyObject>,
343 ) -> Retained<Self>;
344
345 #[cfg(all(feature = "objc2-core-media", feature = "objc2-image-io"))]
346 /// Creates a VNImageRequestHandler to be used for performing requests against the image buffer contained in the CMSampleBufferRef
347 ///
348 ///
349 /// Parameter `sampleBuffer`: A CMSampleBuffer containing the imageBuffer that will be used for performing the requests. Not all types of sample buffers are supported. They need to contain a CVImageBuffer, be valid and ready.
350 ///
351 /// 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.
352 ///
353 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image like VNImageOptionCameraIntrinsics
354 ///
355 /// Note: CMSampleBuffers can contain metadata like camera intrinsics that will be used by algorithms supporting it unless overwritten by the options.
356 ///
357 /// Note: : Because CoreImage is unable to render certain pixel formats in the iOS simulator, request results may not be accurate in those cases.
358 ///
359 /// # Safety
360 ///
361 /// `options` generic should be of the correct type.
362 #[unsafe(method(initWithCMSampleBuffer:orientation:options:))]
363 #[unsafe(method_family = init)]
364 pub unsafe fn initWithCMSampleBuffer_orientation_options(
365 this: Allocated<Self>,
366 sample_buffer: &CMSampleBuffer,
367 orientation: CGImagePropertyOrientation,
368 options: &NSDictionary<VNImageOption, AnyObject>,
369 ) -> Retained<Self>;
370
371 #[cfg(all(
372 feature = "objc2-av-foundation",
373 feature = "objc2-core-media",
374 feature = "objc2-image-io"
375 ))]
376 /// Creates a VNImageRequestHandler to be used for performing requests against the image buffer contained in the CMSampleBufferRef
377 ///
378 ///
379 /// Parameter `sampleBuffer`: A CMSampleBuffer containing the imageBuffer that will be used for performing the requests. Not all types of sample buffers are supported. They need to contain a CVImageBuffer, be valid and ready.
380 ///
381 /// Parameter `depthData`: An AVDepthData instance associated with the pixelBuffer
382 ///
383 /// Parameter `orientation`: The orientation of the image and depth buffers 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 and should match for both buffers.
384 ///
385 /// Parameter `options`: A dictionary with options specifying auxiliary information for the buffer/image
386 ///
387 /// Note: CMSampleBuffers can contain metadata like camera intrinsics that will be used by algorithms supporting it unless overwritten by the options.
388 ///
389 /// Note: : Because CoreImage is unable to render certain pixel formats in the iOS simulator, request results may not be accurate in those cases.
390 ///
391 /// # Safety
392 ///
393 /// `options` generic should be of the correct type.
394 #[unsafe(method(initWithCMSampleBuffer:depthData:orientation:options:))]
395 #[unsafe(method_family = init)]
396 pub unsafe fn initWithCMSampleBuffer_depthData_orientation_options(
397 this: Allocated<Self>,
398 sample_buffer: &CMSampleBuffer,
399 depth_data: &AVDepthData,
400 orientation: CGImagePropertyOrientation,
401 options: &NSDictionary<VNImageOption, AnyObject>,
402 ) -> Retained<Self>;
403
404 #[cfg(feature = "VNRequest")]
405 /// performRequests schedules one or more VNRequests to be performed. The function returns once all requests have been finished.
406 ///
407 ///
408 /// The results of the VNRequests as well any possible errors of the individual requests are reported in the VNRequests results and error properties.
409 ///
410 ///
411 /// Parameter `requests`: An NSArray of VNRequests that are to be performed.
412 ///
413 /// Parameter `error`: Returns an error that happened during scheduling of the requests. Check individual requests results and errors for their respective success and failures. This parameter is optional.
414 ///
415 /// Returns: Returns true if all requests were scheduled and performed. Check individual requests results and errors for their respective success and failures.
416 #[unsafe(method(performRequests:error:_))]
417 #[unsafe(method_family = none)]
418 pub fn performRequests_error(
419 &self,
420 requests: &NSArray<VNRequest>,
421 ) -> Result<(), Retained<NSError>>;
422 );
423}
424
425/// Methods declared on superclass `NSObject`.
426impl VNImageRequestHandler {
427 extern_methods!(
428 #[unsafe(method(new))]
429 #[unsafe(method_family = new)]
430 pub unsafe fn new() -> Retained<Self>;
431 );
432}
433
434extern_class!(
435 /// Performs requests on a sequence of images.
436 ///
437 /// The VNSequenceRequestHandler is created without any specific image source. The -performRequests:on
438 /// <ImageSource
439 /// >:error: methods will retain the image source for no longer than the lifetime of the call.
440 /// The VNSequenceRequestHandler can choose to also cache state information related to the previously-processed image sources.
441 ///
442 /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnsequencerequesthandler?language=objc)
443 #[unsafe(super(NSObject))]
444 #[derive(Debug, PartialEq, Eq, Hash)]
445 pub struct VNSequenceRequestHandler;
446);
447
448extern_conformance!(
449 unsafe impl NSObjectProtocol for VNSequenceRequestHandler {}
450);
451
452impl VNSequenceRequestHandler {
453 extern_methods!(
454 /// Creates a new object.
455 #[unsafe(method(init))]
456 #[unsafe(method_family = init)]
457 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
458
459 #[cfg(all(feature = "VNRequest", feature = "objc2-core-video"))]
460 /// Perform requests on an image in a CVPixelBuffer.
461 ///
462 ///
463 /// Parameter `requests`: The VNRequests to be performed on the image.
464 ///
465 ///
466 /// Parameter `pixelBuffer`: The CVPixelBuffer containing the image to be processed.
467 ///
468 ///
469 /// Parameter `error`: On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify NULL for this parameter if you do not want the error information.
470 #[unsafe(method(performRequests:onCVPixelBuffer:error:_))]
471 #[unsafe(method_family = none)]
472 pub unsafe fn performRequests_onCVPixelBuffer_error(
473 &self,
474 requests: &NSArray<VNRequest>,
475 pixel_buffer: &CVPixelBuffer,
476 ) -> Result<(), Retained<NSError>>;
477
478 #[cfg(all(
479 feature = "VNRequest",
480 feature = "objc2-core-video",
481 feature = "objc2-image-io"
482 ))]
483 /// Perform requests on an image in a CVPixelBuffer.
484 ///
485 ///
486 /// Parameter `requests`: The VNRequests to be performed on the image.
487 ///
488 ///
489 /// Parameter `pixelBuffer`: The CVPixelBuffer containing the image to be processed.
490 ///
491 ///
492 /// Parameter `orientation`: The orientation of the image as it is captured in the pixel buffer.
493 ///
494 ///
495 /// Parameter `error`: On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify NULL for this parameter if you do not want the error information.
496 #[unsafe(method(performRequests:onCVPixelBuffer:orientation:error:_))]
497 #[unsafe(method_family = none)]
498 pub unsafe fn performRequests_onCVPixelBuffer_orientation_error(
499 &self,
500 requests: &NSArray<VNRequest>,
501 pixel_buffer: &CVPixelBuffer,
502 orientation: CGImagePropertyOrientation,
503 ) -> Result<(), Retained<NSError>>;
504
505 #[cfg(all(feature = "VNRequest", feature = "objc2-core-graphics"))]
506 /// Perform requests on an image in a CGImageRef.
507 ///
508 ///
509 /// Parameter `requests`: The VNRequests to be performed on the image.
510 ///
511 ///
512 /// Parameter `image`: The CGImageRef containing the image to be processed.
513 ///
514 ///
515 /// Parameter `error`: On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify NULL for this parameter if you do not want the error information.
516 #[unsafe(method(performRequests:onCGImage:error:_))]
517 #[unsafe(method_family = none)]
518 pub unsafe fn performRequests_onCGImage_error(
519 &self,
520 requests: &NSArray<VNRequest>,
521 image: &CGImage,
522 ) -> Result<(), Retained<NSError>>;
523
524 #[cfg(all(
525 feature = "VNRequest",
526 feature = "objc2-core-graphics",
527 feature = "objc2-image-io"
528 ))]
529 /// Perform requests on an image in a CGImageRef.
530 ///
531 ///
532 /// Parameter `requests`: The VNRequests to be performed on the image.
533 ///
534 ///
535 /// Parameter `image`: The CGImageRef containing the image to be processed.
536 ///
537 ///
538 /// Parameter `orientation`: The orientation of the image.
539 ///
540 ///
541 /// Parameter `error`: On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify NULL for this parameter if you do not want the error information.
542 #[unsafe(method(performRequests:onCGImage:orientation:error:_))]
543 #[unsafe(method_family = none)]
544 pub unsafe fn performRequests_onCGImage_orientation_error(
545 &self,
546 requests: &NSArray<VNRequest>,
547 image: &CGImage,
548 orientation: CGImagePropertyOrientation,
549 ) -> Result<(), Retained<NSError>>;
550
551 #[cfg(all(feature = "VNRequest", feature = "objc2-core-image"))]
552 /// Perform requests on an image in a CIImage.
553 ///
554 ///
555 /// Parameter `requests`: The VNRequests to be performed on the image.
556 ///
557 ///
558 /// Parameter `image`: The CIImage containing the image to be processed.
559 ///
560 ///
561 /// Parameter `error`: On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify NULL for this parameter if you do not want the error information.
562 #[unsafe(method(performRequests:onCIImage:error:_))]
563 #[unsafe(method_family = none)]
564 pub unsafe fn performRequests_onCIImage_error(
565 &self,
566 requests: &NSArray<VNRequest>,
567 image: &CIImage,
568 ) -> Result<(), Retained<NSError>>;
569
570 #[cfg(all(
571 feature = "VNRequest",
572 feature = "objc2-core-image",
573 feature = "objc2-image-io"
574 ))]
575 /// Perform requests on an image in a CIImage.
576 ///
577 ///
578 /// Parameter `requests`: The VNRequests to be performed on the image.
579 ///
580 ///
581 /// Parameter `image`: The CIImage containing the image to be processed.
582 ///
583 ///
584 /// Parameter `orientation`: The orientation of the image.
585 ///
586 ///
587 /// Parameter `error`: On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify NULL for this parameter if you do not want the error information.
588 #[unsafe(method(performRequests:onCIImage:orientation:error:_))]
589 #[unsafe(method_family = none)]
590 pub unsafe fn performRequests_onCIImage_orientation_error(
591 &self,
592 requests: &NSArray<VNRequest>,
593 image: &CIImage,
594 orientation: CGImagePropertyOrientation,
595 ) -> Result<(), Retained<NSError>>;
596
597 #[cfg(feature = "VNRequest")]
598 /// Perform requests on an image referenced by an URL.
599 ///
600 ///
601 /// Parameter `requests`: The VNRequests to be performed on the image.
602 ///
603 ///
604 /// Parameter `imageURL`: The URL of the image to be processed. If this is not a file-based URL, the method will fail.
605 ///
606 ///
607 /// Parameter `error`: On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify NULL for this parameter if you do not want the error information.
608 #[unsafe(method(performRequests:onImageURL:error:_))]
609 #[unsafe(method_family = none)]
610 pub unsafe fn performRequests_onImageURL_error(
611 &self,
612 requests: &NSArray<VNRequest>,
613 image_url: &NSURL,
614 ) -> Result<(), Retained<NSError>>;
615
616 #[cfg(all(feature = "VNRequest", feature = "objc2-image-io"))]
617 /// Perform requests on an image referenced by an URL.
618 ///
619 ///
620 /// Parameter `requests`: The VNRequests to be performed on the image.
621 ///
622 ///
623 /// Parameter `imageURL`: The URL of the image to be processed. If this is not a file-based URL, the method will fail.
624 ///
625 ///
626 /// Parameter `orientation`: The orientation of the image.
627 ///
628 ///
629 /// Parameter `error`: On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify NULL for this parameter if you do not want the error information.
630 #[unsafe(method(performRequests:onImageURL:orientation:error:_))]
631 #[unsafe(method_family = none)]
632 pub unsafe fn performRequests_onImageURL_orientation_error(
633 &self,
634 requests: &NSArray<VNRequest>,
635 image_url: &NSURL,
636 orientation: CGImagePropertyOrientation,
637 ) -> Result<(), Retained<NSError>>;
638
639 #[cfg(feature = "VNRequest")]
640 /// Perform requests on an image with its source format in memory.
641 ///
642 ///
643 /// Parameter `requests`: The VNRequests to be performed on the image.
644 ///
645 ///
646 /// Parameter `imageData`: The data representing the source format of the image to be processed.
647 ///
648 ///
649 /// Parameter `error`: On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify NULL for this parameter if you do not want the error information.
650 #[unsafe(method(performRequests:onImageData:error:_))]
651 #[unsafe(method_family = none)]
652 pub unsafe fn performRequests_onImageData_error(
653 &self,
654 requests: &NSArray<VNRequest>,
655 image_data: &NSData,
656 ) -> Result<(), Retained<NSError>>;
657
658 #[cfg(all(feature = "VNRequest", feature = "objc2-image-io"))]
659 /// Perform requests on an image with its source format in memory.
660 ///
661 ///
662 /// Parameter `requests`: The VNRequests to be performed on the image.
663 ///
664 ///
665 /// Parameter `imageData`: The data representing the source format of the image to be processed.
666 ///
667 ///
668 /// Parameter `orientation`: The orientation of the image.
669 ///
670 ///
671 /// Parameter `error`: On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify NULL for this parameter if you do not want the error information.
672 #[unsafe(method(performRequests:onImageData:orientation:error:_))]
673 #[unsafe(method_family = none)]
674 pub unsafe fn performRequests_onImageData_orientation_error(
675 &self,
676 requests: &NSArray<VNRequest>,
677 image_data: &NSData,
678 orientation: CGImagePropertyOrientation,
679 ) -> Result<(), Retained<NSError>>;
680
681 #[cfg(all(feature = "VNRequest", feature = "objc2-core-media"))]
682 /// Perform requests on the image buffer contained in the CMSampleBufferRef.
683 ///
684 ///
685 /// Parameter `requests`: The VNRequests to be performed on the image.
686 ///
687 ///
688 /// Parameter `sampleBuffer`: A CMSampleBuffer containing an image that will be used for performing the requests. Not all types of sample buffers are supported. They need to contain a CVImageBuffer, be valid and ready.
689 ///
690 ///
691 /// Parameter `error`: On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify NULL for this parameter if you do not want the error information.
692 #[unsafe(method(performRequests:onCMSampleBuffer:error:_))]
693 #[unsafe(method_family = none)]
694 pub unsafe fn performRequests_onCMSampleBuffer_error(
695 &self,
696 requests: &NSArray<VNRequest>,
697 sample_buffer: &CMSampleBuffer,
698 ) -> Result<(), Retained<NSError>>;
699
700 #[cfg(all(
701 feature = "VNRequest",
702 feature = "objc2-core-media",
703 feature = "objc2-image-io"
704 ))]
705 /// Perform requests on the image buffer contained in the CMSampleBufferRef.
706 ///
707 ///
708 /// Parameter `requests`: The VNRequests to be performed on the image.
709 ///
710 ///
711 /// Parameter `sampleBuffer`: A CMSampleBuffer containing an image that will be used for performing the requests. Not all types of sample buffers are supported. They need to contain a CVImageBuffer, be valid and ready.
712 ///
713 ///
714 /// Parameter `orientation`: The orientation of the image.
715 ///
716 ///
717 /// Parameter `error`: On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify NULL for this parameter if you do not want the error information.
718 #[unsafe(method(performRequests:onCMSampleBuffer:orientation:error:_))]
719 #[unsafe(method_family = none)]
720 pub unsafe fn performRequests_onCMSampleBuffer_orientation_error(
721 &self,
722 requests: &NSArray<VNRequest>,
723 sample_buffer: &CMSampleBuffer,
724 orientation: CGImagePropertyOrientation,
725 ) -> Result<(), Retained<NSError>>;
726 );
727}
728
729/// Methods declared on superclass `NSObject`.
730impl VNSequenceRequestHandler {
731 extern_methods!(
732 #[unsafe(method(new))]
733 #[unsafe(method_family = new)]
734 pub unsafe fn new() -> Retained<Self>;
735 );
736}