leptess

Crates.ioleptess
lib.rsleptess
version0.14.0
sourcesrc
created_at2019-06-02 23:06:09.07683
updated_at2023-02-21 21:54:36.670571
descriptionProductive Rust binding for Tesseract and Leptonica.
homepagehttps://github.com/houqp/leptess
repositoryhttps://github.com/houqp/leptess
max_upload_size
id138591
size4,462,931
QP Hou (houqp)

documentation

https://houqp.github.io/leptess/leptess/index.html

README

Leptess

Test Crates.io Docs

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

Build dependencies

Make sure you have clang, Leptonica and Tesseract installed.

Tesseract should be version 4.0.0 or above.

Ubuntu

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

Mac

brew install tesseract leptonica

Windows

On Windows, this library uses Microsoft's vcpkg to provide tesseract.

Please install vcpkg and set up user wide integration or vcpkg crate won't be able to find the library.

To install tesseract:

REM from the vcpkg directory

REM 32 bit
.\vcpkg install tesseract:x86-windows

REM 64 bit
.\vcpkg install tesseract:x64-windows

To run the tests configure vcpkg-crate to find the tesseract library:

SET VCPKGRS_DYNAMIC=true
cargo test

Usage

let mut lt = leptess::LepTess::new(None, "eng").unwrap();
lt.set_image("path/to/page.bmp");
println!("{}", lt.get_utf8_text().unwrap());

For more examples, see docs and examples directory.

To run demos in examples directory, try:

cargo run --example low_level_ocr_full_page

Development

To run tests, you will need at Tesseract 4.x or 5.x to match what we have in tests/tessdata/eng.traineddata. See GitHub config actions to see how to replicate the setup.

Commit count: 110

cargo fmt