[][src]Crate leptess

Productive and safe Rust bindings/wrappers for Leptonica and Tesseract.

Overview

It comes with a high level wrapper LepTess focusing on productivity and memory safty:

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());

api.destroy();
pix.destroy();

Raw unsafe C API bindings are auto-generated using bindgen. To update the binding, run:

make gen

Build dependencies

Make sure you have Leptonica and Tesseract installed.

For Ubuntu user:

sudo apt-get install libleptonica-dev libtesseract-dev

You will also need to install tesseract language data based on your OCR needs:

sudo apt-get install tesseract-ocr-eng

Modules

capi

Raw (unsafe) C API binding for Leptonica and Tesseract

leptonica

Low level wrapper for Leptonica C API

tesseract

Low level wrapper for Tesseract C API

Structs

LepTess

High level wrapper for Tesseract and Leptonica