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
32extern "C" {
33 pub fn vn_string_free(s: *mut c_char);
34
35 pub fn vn_recognize_text_in_path(
36 path: *const c_char,
37 recognition_level: i32,
38 uses_language_correction: bool,
39 out_array: *mut *mut c_void,
40 out_count: *mut usize,
41 out_error_message: *mut *mut c_char,
42 ) -> i32;
43
44 pub fn vn_recognize_text_in_pixel_buffer(
45 pixel_buffer: *mut c_void,
46 recognition_level: i32,
47 uses_language_correction: bool,
48 out_array: *mut *mut c_void,
49 out_count: *mut usize,
50 out_error_message: *mut *mut c_char,
51 ) -> i32;
52
53 pub fn vn_recognized_text_free(array: *mut c_void, count: usize);
54
55 pub fn vn_detect_faces_in_path(
56 path: *const c_char,
57 out_array: *mut *mut c_void,
58 out_count: *mut usize,
59 out_error_message: *mut *mut c_char,
60 ) -> i32;
61
62 pub fn vn_detect_faces_in_pixel_buffer(
63 pixel_buffer: *mut c_void,
64 out_array: *mut *mut c_void,
65 out_count: *mut usize,
66 out_error_message: *mut *mut c_char,
67 ) -> i32;
68
69 pub fn vn_detected_faces_free(array: *mut c_void, count: usize);
70
71 pub fn vn_test_helper_render_text_png(
72 text: *const c_char,
73 width: i32,
74 height: i32,
75 output_path: *const c_char,
76 ) -> i32;
77}
78
79pub mod status {
80 pub const OK: i32 = 0;
81 pub const INVALID_ARGUMENT: i32 = -1;
82 pub const IMAGE_LOAD_FAILED: i32 = -2;
83 pub const REQUEST_FAILED: i32 = -3;
84 pub const UNKNOWN: i32 = -99;
85}
86
87const _: () = {
89 let _ = core::mem::size_of::<*mut c_void>();
90};