Expand description
Productive and safe Rust bindings/wrappers for Leptonica and Tesseract.
Overview
It comes with a high level wrapper LepTess focusing on productivity and memory safety:
let mut lt = leptess::LepTess::new(Some("./tests/tessdata"), "eng").unwrap();
lt.set_image("./tests/di.png");
println!("{}", lt.get_utf8_text().unwrap());
It also exposes low level bindings to for flexibitliy and close mirroring of upstream C APIs:
use std::path::Path;
let mut api = leptess::tesseract::TessApi::new(Some("./tests/tessdata"), "eng").unwrap();
let mut pix = leptess::leptonica::pix_read(Path::new("./tests/di.png")).unwrap();
api.set_image(&pix);
let text = api.get_utf8_text();
println!("{}", text.unwrap());
Raw unsafe C API bindings are auto-generated using bindgen at compile time.
Build dependencies
Make sure you have Leptonica and Tesseract installed.
For Ubuntu user:
sudo apt-get install libleptonica-dev libtesseract-dev clang
You will also need to install tesseract language data based on your OCR needs:
sudo apt-get install tesseract-ocr-eng
Modules
- Low level wrapper for Leptonica C API
- Low level wrapper for Tesseract C API
Structs
- High level wrapper for Tesseract and Leptonica
Enums
- Enum representing different variable options accepted by Tesseract