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
97extern "C" {
98 pub fn vn_string_free(s: *mut c_char);
99
100 pub fn vn_recognize_text_in_path(
101 path: *const c_char,
102 recognition_level: i32,
103 uses_language_correction: bool,
104 out_array: *mut *mut c_void,
105 out_count: *mut usize,
106 out_error_message: *mut *mut c_char,
107 ) -> i32;
108
109 pub fn vn_recognize_text_in_pixel_buffer(
110 pixel_buffer: *mut c_void,
111 recognition_level: i32,
112 uses_language_correction: bool,
113 out_array: *mut *mut c_void,
114 out_count: *mut usize,
115 out_error_message: *mut *mut c_char,
116 ) -> i32;
117
118 pub fn vn_recognized_text_free(array: *mut c_void, count: usize);
119
120 pub fn vn_detect_faces_in_path(
121 path: *const c_char,
122 out_array: *mut *mut c_void,
123 out_count: *mut usize,
124 out_error_message: *mut *mut c_char,
125 ) -> i32;
126
127 pub fn vn_detect_faces_in_pixel_buffer(
128 pixel_buffer: *mut c_void,
129 out_array: *mut *mut c_void,
130 out_count: *mut usize,
131 out_error_message: *mut *mut c_char,
132 ) -> i32;
133
134 pub fn vn_detected_faces_free(array: *mut c_void, count: usize);
135
136 pub fn vn_detect_barcodes_in_path(
137 path: *const c_char,
138 out_array: *mut *mut c_void,
139 out_count: *mut usize,
140 out_error_message: *mut *mut c_char,
141 ) -> i32;
142
143 pub fn vn_detected_barcodes_free(array: *mut c_void, count: usize);
144
145 pub fn vn_attention_saliency_in_path(
146 path: *const c_char,
147 out_array: *mut *mut c_void,
148 out_count: *mut usize,
149 out_error_message: *mut *mut c_char,
150 ) -> i32;
151
152 pub fn vn_saliency_regions_free(array: *mut c_void, count: usize);
153
154 pub fn vn_detect_face_landmarks_in_path(
155 path: *const c_char,
156 out_array: *mut *mut c_void,
157 out_count: *mut usize,
158 out_error_message: *mut *mut c_char,
159 ) -> i32;
160
161 pub fn vn_face_landmarks_free(array: *mut c_void, count: usize);
162
163 pub fn vn_test_helper_render_text_png(
164 text: *const c_char,
165 width: i32,
166 height: i32,
167 output_path: *const c_char,
168 ) -> i32;
169}
170
171pub mod status {
172 pub const OK: i32 = 0;
173 pub const INVALID_ARGUMENT: i32 = -1;
174 pub const IMAGE_LOAD_FAILED: i32 = -2;
175 pub const REQUEST_FAILED: i32 = -3;
176 pub const UNKNOWN: i32 = -99;
177}
178
179const _: () = {
181 let _ = core::mem::size_of::<*mut c_void>();
182};