1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#![allow(
unused_parens,
clippy::excessive_precision,
clippy::missing_safety_doc,
clippy::not_unsafe_ptr_arg_deref,
clippy::should_implement_trait,
clippy::too_many_arguments,
clippy::unused_unit,
)]
use crate::{mod_prelude::*, core, sys, types};
pub mod prelude {
pub use { super::BarcodeDetectorTraitConst, super::BarcodeDetectorTrait };
}
pub const EAN_13: i32 = 2;
pub const EAN_8: i32 = 1;
pub const NONE: i32 = 0;
pub const UPC_A: i32 = 3;
pub const UPC_E: i32 = 4;
pub const UPC_EAN_EXTENSION: i32 = 5;
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum BarcodeType {
NONE = 0,
EAN_8 = 1,
EAN_13 = 2,
UPC_A = 3,
UPC_E = 4,
UPC_EAN_EXTENSION = 5,
}
opencv_type_enum! { crate::barcode::BarcodeType }
pub trait BarcodeDetectorTraitConst {
fn as_raw_BarcodeDetector(&self) -> *const c_void;
#[inline]
fn detect(&self, img: &dyn core::ToInputArray, points: &mut dyn core::ToOutputArray) -> Result<bool> {
input_array_arg!(img);
output_array_arg!(points);
unsafe { sys::cv_barcode_BarcodeDetector_detect_const_const__InputArrayR_const__OutputArrayR(self.as_raw_BarcodeDetector(), img.as_raw__InputArray(), points.as_raw__OutputArray()) }.into_result()
}
#[inline]
fn decode(&self, img: &dyn core::ToInputArray, points: &dyn core::ToInputArray, decoded_info: &mut core::Vector<String>, decoded_type: &mut core::Vector<crate::barcode::BarcodeType>) -> Result<bool> {
input_array_arg!(img);
input_array_arg!(points);
unsafe { sys::cv_barcode_BarcodeDetector_decode_const_const__InputArrayR_const__InputArrayR_vector_string_R_vector_BarcodeType_R(self.as_raw_BarcodeDetector(), img.as_raw__InputArray(), points.as_raw__InputArray(), decoded_info.as_raw_mut_VectorOfString(), decoded_type.as_raw_mut_VectorOfBarcodeType()) }.into_result()
}
#[inline]
fn detect_and_decode(&self, img: &dyn core::ToInputArray, decoded_info: &mut core::Vector<String>, decoded_type: &mut core::Vector<crate::barcode::BarcodeType>, points: &mut dyn core::ToOutputArray) -> Result<bool> {
input_array_arg!(img);
output_array_arg!(points);
unsafe { sys::cv_barcode_BarcodeDetector_detectAndDecode_const_const__InputArrayR_vector_string_R_vector_BarcodeType_R_const__OutputArrayR(self.as_raw_BarcodeDetector(), img.as_raw__InputArray(), decoded_info.as_raw_mut_VectorOfString(), decoded_type.as_raw_mut_VectorOfBarcodeType(), points.as_raw__OutputArray()) }.into_result()
}
}
pub trait BarcodeDetectorTrait: crate::barcode::BarcodeDetectorTraitConst {
fn as_raw_mut_BarcodeDetector(&mut self) -> *mut c_void;
}
pub struct BarcodeDetector {
ptr: *mut c_void
}
opencv_type_boxed! { BarcodeDetector }
impl Drop for BarcodeDetector {
fn drop(&mut self) {
extern "C" { fn cv_BarcodeDetector_delete(instance: *mut c_void); }
unsafe { cv_BarcodeDetector_delete(self.as_raw_mut_BarcodeDetector()) };
}
}
unsafe impl Send for BarcodeDetector {}
impl crate::barcode::BarcodeDetectorTraitConst for BarcodeDetector {
#[inline] fn as_raw_BarcodeDetector(&self) -> *const c_void { self.as_raw() }
}
impl crate::barcode::BarcodeDetectorTrait for BarcodeDetector {
#[inline] fn as_raw_mut_BarcodeDetector(&mut self) -> *mut c_void { self.as_raw_mut() }
}
impl BarcodeDetector {
#[inline]
pub fn new(prototxt_path: &str, model_path: &str) -> Result<crate::barcode::BarcodeDetector> {
extern_container_arg!(prototxt_path);
extern_container_arg!(model_path);
unsafe { sys::cv_barcode_BarcodeDetector_BarcodeDetector_const_stringR_const_stringR(prototxt_path.opencv_as_extern(), model_path.opencv_as_extern()) }.into_result().map(|r| unsafe { crate::barcode::BarcodeDetector::opencv_from_extern(r) } )
}
}