pub const DEFAULT_ALPHABET: &str = " 0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~€ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
#[derive(Clone, Debug, PartialEq)]
pub struct DetectionParams {
pub min_area: f32,
pub text_threshold: f32,
}
impl Default for DetectionParams {
fn default() -> Self {
Self {
min_area: 100.,
text_threshold: 0.2,
}
}
}
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub enum DecodeMethod {
#[default]
Greedy,
BeamSearch {
width: u32,
},
}
pub const RECOGNITION_INPUT_HEIGHT: u32 = 64;
#[derive(Clone, Debug)]
pub struct OcrConfig {
pub detection: DetectionParams,
pub decode_method: DecodeMethod,
pub alphabet: String,
}
impl Default for OcrConfig {
fn default() -> Self {
Self {
detection: DetectionParams::default(),
decode_method: DecodeMethod::default(),
alphabet: DEFAULT_ALPHABET.to_string(),
}
}
}