1#![allow(missing_docs, non_camel_case_types)]
5
6use core::ffi::{c_char, c_void};
7
8#[repr(C)]
10pub struct RecognizedTextRaw {
11 pub text: *mut c_char,
12 pub confidence: f32,
13 pub bbox_x: f64,
14 pub bbox_y: f64,
15 pub bbox_w: f64,
16 pub bbox_h: f64,
17}
18
19#[repr(C)]
21pub struct DetectedFaceRaw {
22 pub bbox_x: f64,
23 pub bbox_y: f64,
24 pub bbox_w: f64,
25 pub bbox_h: f64,
26 pub confidence: f32,
27 pub roll: f32,
28 pub yaw: f32,
29 pub pitch: f32,
30}
31
32#[repr(C)]
34pub struct DetectedBarcodeRaw {
35 pub payload: *mut c_char,
36 pub symbology: *mut c_char,
37 pub confidence: f32,
38 pub bbox_x: f64,
39 pub bbox_y: f64,
40 pub bbox_w: f64,
41 pub bbox_h: f64,
42}
43
44#[repr(C)]
46pub struct SaliencyRegionRaw {
47 pub confidence: f32,
48 pub bbox_x: f64,
49 pub bbox_y: f64,
50 pub bbox_w: f64,
51 pub bbox_h: f64,
52}
53
54#[repr(C)]
61pub struct FaceLandmarksRaw {
62 pub bbox_x: f64,
63 pub bbox_y: f64,
64 pub bbox_w: f64,
65 pub bbox_h: f64,
66 pub confidence: f32,
67 pub roll: f32,
68 pub yaw: f32,
69 pub pitch: f32,
70
71 pub face_contour: *mut f64,
72 pub face_contour_count: usize,
73 pub left_eye: *mut f64,
74 pub left_eye_count: usize,
75 pub right_eye: *mut f64,
76 pub right_eye_count: usize,
77 pub left_eyebrow: *mut f64,
78 pub left_eyebrow_count: usize,
79 pub right_eyebrow: *mut f64,
80 pub right_eyebrow_count: usize,
81 pub nose: *mut f64,
82 pub nose_count: usize,
83 pub nose_crest: *mut f64,
84 pub nose_crest_count: usize,
85 pub median_line: *mut f64,
86 pub median_line_count: usize,
87 pub outer_lips: *mut f64,
88 pub outer_lips_count: usize,
89 pub inner_lips: *mut f64,
90 pub inner_lips_count: usize,
91 pub left_pupil: *mut f64,
92 pub left_pupil_count: usize,
93 pub right_pupil: *mut f64,
94 pub right_pupil_count: usize,
95}
96
97#[repr(C)]
99pub struct PoseObservationRaw {
100 pub bbox_x: f64,
101 pub bbox_y: f64,
102 pub bbox_w: f64,
103 pub bbox_h: f64,
104 pub confidence: f32,
105 pub joint_names: *mut *mut c_char,
106 pub joint_xs: *mut f64,
107 pub joint_ys: *mut f64,
108 pub joint_confidences: *mut f32,
109 pub joint_count: usize,
110}
111
112#[repr(C)]
114pub struct ContourRaw {
115 pub point_xs: *mut f64,
116 pub point_ys: *mut f64,
117 pub point_count: usize,
118 pub child_count: isize,
119 pub aspect_ratio: f32,
120}
121
122#[repr(C)]
124pub struct RecognizedAnimalRaw {
125 pub identifier: *mut c_char,
126 pub confidence: f32,
127 pub bbox_x: f64,
128 pub bbox_y: f64,
129 pub bbox_w: f64,
130 pub bbox_h: f64,
131}
132
133#[repr(C)]
135pub struct ClassificationRaw {
136 pub identifier: *mut c_char,
137 pub confidence: f32,
138}
139
140#[repr(C)]
142pub struct RectangleObservationRaw {
143 pub bbox_x: f64,
144 pub bbox_y: f64,
145 pub bbox_w: f64,
146 pub bbox_h: f64,
147 pub confidence: f32,
148 pub tl_x: f64,
149 pub tl_y: f64,
150 pub tr_x: f64,
151 pub tr_y: f64,
152 pub bl_x: f64,
153 pub bl_y: f64,
154 pub br_x: f64,
155 pub br_y: f64,
156}
157
158#[repr(C)]
160pub struct FeaturePrintRaw {
161 pub element_type: i32,
162 pub element_count: usize,
163 pub bytes: *mut c_void,
164}
165
166#[repr(C)]
168pub struct HumanObservationRaw {
169 pub bbox_x: f64,
170 pub bbox_y: f64,
171 pub bbox_w: f64,
172 pub bbox_h: f64,
173 pub confidence: f32,
174 pub upper_body_only: bool,
175}
176
177extern "C" {
178 pub fn vn_string_free(s: *mut c_char);
179
180 pub fn vn_recognize_text_in_path(
181 path: *const c_char,
182 recognition_level: i32,
183 uses_language_correction: bool,
184 out_array: *mut *mut c_void,
185 out_count: *mut usize,
186 out_error_message: *mut *mut c_char,
187 ) -> i32;
188
189 pub fn vn_recognize_text_in_pixel_buffer(
190 pixel_buffer: *mut c_void,
191 recognition_level: i32,
192 uses_language_correction: bool,
193 out_array: *mut *mut c_void,
194 out_count: *mut usize,
195 out_error_message: *mut *mut c_char,
196 ) -> i32;
197
198 pub fn vn_recognized_text_free(array: *mut c_void, count: usize);
199
200 pub fn vn_detect_faces_in_path(
201 path: *const c_char,
202 out_array: *mut *mut c_void,
203 out_count: *mut usize,
204 out_error_message: *mut *mut c_char,
205 ) -> i32;
206
207 pub fn vn_detect_faces_in_pixel_buffer(
208 pixel_buffer: *mut c_void,
209 out_array: *mut *mut c_void,
210 out_count: *mut usize,
211 out_error_message: *mut *mut c_char,
212 ) -> i32;
213
214 pub fn vn_detected_faces_free(array: *mut c_void, count: usize);
215
216 pub fn vn_detect_barcodes_in_path(
217 path: *const c_char,
218 out_array: *mut *mut c_void,
219 out_count: *mut usize,
220 out_error_message: *mut *mut c_char,
221 ) -> i32;
222
223 pub fn vn_detected_barcodes_free(array: *mut c_void, count: usize);
224
225 pub fn vn_attention_saliency_in_path(
226 path: *const c_char,
227 out_array: *mut *mut c_void,
228 out_count: *mut usize,
229 out_error_message: *mut *mut c_char,
230 ) -> i32;
231
232 pub fn vn_saliency_regions_free(array: *mut c_void, count: usize);
233
234 pub fn vn_detect_face_landmarks_in_path(
235 path: *const c_char,
236 out_array: *mut *mut c_void,
237 out_count: *mut usize,
238 out_error_message: *mut *mut c_char,
239 ) -> i32;
240
241 pub fn vn_face_landmarks_free(array: *mut c_void, count: usize);
242
243 pub fn vn_detect_human_body_pose_in_path(
244 path: *const c_char,
245 out_array: *mut *mut c_void,
246 out_count: *mut usize,
247 out_error_message: *mut *mut c_char,
248 ) -> i32;
249
250 pub fn vn_detect_human_hand_pose_in_path(
251 path: *const c_char,
252 max_hands: usize,
253 out_array: *mut *mut c_void,
254 out_count: *mut usize,
255 out_error_message: *mut *mut c_char,
256 ) -> i32;
257
258 pub fn vn_pose_observations_free(array: *mut c_void, count: usize);
259
260 pub fn vn_detect_contours_in_path(
261 path: *const c_char,
262 contrast_adjustment: f32,
263 detects_dark_on_light: bool,
264 out_array: *mut *mut c_void,
265 out_count: *mut usize,
266 out_error_message: *mut *mut c_char,
267 ) -> i32;
268
269 pub fn vn_contours_free(array: *mut c_void, count: usize);
270
271 pub fn vn_recognize_animals_in_path(
272 path: *const c_char,
273 out_array: *mut *mut c_void,
274 out_count: *mut usize,
275 out_error_message: *mut *mut c_char,
276 ) -> i32;
277
278 pub fn vn_recognized_animals_free(array: *mut c_void, count: usize);
279
280 pub fn vn_classify_image_in_path(
281 path: *const c_char,
282 out_array: *mut *mut c_void,
283 out_count: *mut usize,
284 out_error_message: *mut *mut c_char,
285 ) -> i32;
286 pub fn vn_classifications_free(array: *mut c_void, count: usize);
287
288 pub fn vn_detect_rectangles_in_path(
289 path: *const c_char,
290 max_observations: usize,
291 minimum_aspect_ratio: f32,
292 maximum_aspect_ratio: f32,
293 minimum_size: f32,
294 minimum_confidence: f32,
295 out_array: *mut *mut c_void,
296 out_count: *mut usize,
297 out_error_message: *mut *mut c_char,
298 ) -> i32;
299
300 pub fn vn_detect_document_segmentation_in_path(
301 path: *const c_char,
302 out_array: *mut *mut c_void,
303 out_count: *mut usize,
304 out_error_message: *mut *mut c_char,
305 ) -> i32;
306
307 pub fn vn_rectangle_observations_free(array: *mut c_void, count: usize);
308
309 pub fn vn_detect_horizon_in_path(
310 path: *const c_char,
311 out_angle: *mut f64,
312 out_has_value: *mut bool,
313 out_error_message: *mut *mut c_char,
314 ) -> i32;
315
316 pub fn vn_generate_image_feature_print_in_path(
317 path: *const c_char,
318 out_feature: *mut FeaturePrintRaw,
319 out_error_message: *mut *mut c_char,
320 ) -> i32;
321 pub fn vn_feature_print_free(feature: *mut FeaturePrintRaw);
322
323 pub fn vn_detect_human_rectangles_in_path(
324 path: *const c_char,
325 upper_body_only: bool,
326 out_array: *mut *mut c_void,
327 out_count: *mut usize,
328 out_error_message: *mut *mut c_char,
329 ) -> i32;
330 pub fn vn_human_observations_free(array: *mut c_void, count: usize);
331
332 pub fn vn_test_helper_render_text_png(
333 text: *const c_char,
334 width: i32,
335 height: i32,
336 output_path: *const c_char,
337 ) -> i32;
338}
339
340pub mod status {
341 pub const OK: i32 = 0;
342 pub const INVALID_ARGUMENT: i32 = -1;
343 pub const IMAGE_LOAD_FAILED: i32 = -2;
344 pub const REQUEST_FAILED: i32 = -3;
345 pub const UNKNOWN: i32 = -99;
346}
347
348const _: () = {
350 let _ = core::mem::size_of::<*mut c_void>();
351};