Skip to main content

Crate manga_ocr_rs

Crate manga_ocr_rs 

Source
Expand description

Japanese manga OCR — image-to-text for scanned manga and printed Japanese.

Runs mayocream/manga-ocr-onnx (kha-white/manga-ocr-base exported to ONNX) via ONNX Runtime. Returns raw Japanese text; no translation, no furigana stripping.

Handles yokogaki (horizontal), tategaki (vertical), and tegaki (handwritten) text. Images are squish-resized to 224×224 matching the original training pipeline.

§Quick start

use manga_ocr_rs::MangaOcr;

let ocr = MangaOcr::new(manga_ocr_rs::default_model_dir()).unwrap();
let img = image::open("panel.png").unwrap();
println!("{}", ocr.recognize(&img).unwrap());

// With confidence scores:
let r = ocr.recognize_with_score(&img).unwrap();
println!("{} (confidence: {:.4})", r.text, r.confidence);

Models are downloaded automatically on first cargo build via build.rs. Override the location by setting MANGA_OCR_MODELS_DIR before building.

Structs§

MangaOcr
OCR engine wrapping the encoder + decoder ONNX sessions and vocabulary.
Recognition
Result of OCR recognition, including confidence metrics.

Functions§

default_model_dir
Returns the directory where build.rs downloaded (or expects) the model files.