mod classifier;
mod common;
mod detector;
mod feat;
pub mod math;
pub mod model;
pub use crate::common::FaceInfo;
pub use crate::common::ImageData;
pub use crate::common::Rectangle;
pub use crate::model::{load_model, read_model, Model};
use crate::detector::FuStDetector;
use std::io;
pub fn create_detector(path_to_model: &str) -> Result<Box<dyn Detector>, io::Error> {
let model = load_model(path_to_model)?;
Ok(create_detector_with_model(model))
}
pub fn create_detector_with_model(model: Model) -> Box<dyn Detector> {
Box::new(FuStDetector::new(model))
}
pub trait Detector {
fn detect(&mut self, image: &ImageData) -> Vec<FaceInfo>;
fn set_window_size(&mut self, wnd_size: u32);
fn set_slide_window_step(&mut self, step_x: u32, step_y: u32);
fn set_min_face_size(&mut self, min_face_size: u32);
fn set_max_face_size(&mut self, max_face_size: u32);
fn set_pyramid_scale_factor(&mut self, scale_factor: f32);
fn set_score_thresh(&mut self, thresh: f64);
}