feat(katana): proper name & series reading

This commit is contained in:
2024-01-05 00:40:57 +07:00
parent 65911d3706
commit d1cee333ed
5 changed files with 245 additions and 104 deletions

View File

@ -2,6 +2,7 @@ pub use log;
pub use tracing::{debug, error, info, trace, warn};
use tracing_subscriber::{self, fmt, EnvFilter};
pub mod constants;
pub mod structs;
pub mod tesseract;
pub fn setup_logger(level: &str) -> Result<(), fern::InitError> {

View File

@ -0,0 +1,7 @@
#[derive(Debug)]
pub struct Card {
pub wishlist: Option<i32>,
pub name: String,
pub series: String,
pub print: i32,
}

View File

@ -5,6 +5,9 @@ pub fn init_tesseract(numeric_only: bool) -> Result<LepTess, String> {
Ok(lep_tess) => lep_tess,
Err(why) => return Err(format!("Failed to initialize Tesseract: {:?}", why)),
};
lep_tess.set_variable(Variable::TesseditPagesegMode, "6").unwrap();
// Use LSTM only.
lep_tess.set_variable(Variable::TesseditOcrEngineMode, "1").unwrap();
if numeric_only {
match lep_tess.set_variable(Variable::TesseditCharWhitelist, "0123456789") {
Ok(_) => (),