feat: use Arc & Mutex for LepTess
This commit is contained in:
@ -5,13 +5,11 @@ pub mod constants;
|
||||
pub mod tesseract;
|
||||
|
||||
pub fn setup_logger(level: &str) -> Result<(), fern::InitError> {
|
||||
// I don't really know how to do it because the unset variable trick doesn't work
|
||||
// since the types can be
|
||||
let formatter = fmt::format()
|
||||
.with_level(true)
|
||||
.with_target(true)
|
||||
.with_thread_ids(false)
|
||||
.with_thread_names(false); // include the name of the current thread.pretty();
|
||||
.with_thread_names(false);
|
||||
let filter = EnvFilter::builder()
|
||||
.from_env()
|
||||
.unwrap()
|
||||
|
||||
@ -1 +1,13 @@
|
||||
pub use leptess::LepTess;
|
||||
pub use leptess::{LepTess, Variable};
|
||||
|
||||
pub fn init_tesseract() -> Result<LepTess, String> {
|
||||
let mut lep_tess = match LepTess::new(None, "eng") {
|
||||
Ok(lep_tess) => lep_tess,
|
||||
Err(why) => return Err(format!("Failed to initialize Tesseract: {:?}", why)),
|
||||
};
|
||||
match lep_tess.set_variable(Variable::TesseditCharWhitelist, "0123456789") {
|
||||
Ok(_) => (),
|
||||
Err(why) => return Err(format!("Failed to set whitelist: {:?}", why)),
|
||||
};
|
||||
Ok(lep_tess)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user