use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default, deny_unknown_fields)]
pub struct DetectionConfig {
pub text_threshold: f32,
pub link_threshold: f32,
pub low_text: f32,
pub canvas_size: u32,
pub mag_ratio: f32,
pub min_size: u32,
pub slope_ths: f32,
pub ycenter_ths: f32,
pub height_ths: f32,
pub width_ths: f32,
pub add_margin: f32,
}
impl Default for DetectionConfig {
fn default() -> Self {
Self {
text_threshold: 0.7,
link_threshold: 0.4,
low_text: 0.4,
canvas_size: 2560,
mag_ratio: 1.0,
min_size: 20,
slope_ths: 0.1,
ycenter_ths: 0.5,
height_ths: 0.5,
width_ths: 0.5,
add_margin: 0.1,
}
}
}