houqp / leptess

Productive and safe Rust binding for leptonica and tesseract
https://houqp.github.io/leptess/leptess/index.html
MIT License
258 stars 28 forks source link

Doesn't work in Arch Linux #61

Open andrewperoramas opened 5 months ago

andrewperoramas commented 5 months ago
sudo pacman -S leptonica tesseract clang
sudo pacman -S tesseract-data-eng

Tried this in archlinux

I did a cargo run and

cargo run

  Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/ocr`
[J README  #[3 MIT license =
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 pkg-config =]
ccouzens commented 5 months ago

Hey,

It's a library rather than a application, so cargo run doesn't work.

What happens when you run cargo test?

You can also run some examples, for example cargo run --example low_level_ocr_full_page

andrewperoramas commented 5 months ago
extern crate leptess;

use leptess::{leptonica, tesseract};
use std::path::Path;

fn main() {
    let mut api = tesseract::TessApi::new(None, "eng").unwrap();

    let pix = leptonica::pix_read(Path::new("./r.png")).unwrap();
    api.set_image(&pix);

    let text = api.get_utf8_text();
    println!("{}", text.unwrap());
}

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

I did cargo test in archlinux setup

This setup works in ubuntu wsl but not in my arch machine.

ccouzens commented 5 months ago

I've just tested in an arch linux container

podman container run --rm -it -v "$HOME/Documents/git/github.com/houqp/leptess/:/leptess:Z" docker.io/archlinux
pacman -Sy leptonica tesseract clang tesseract-data-eng rust screenfetch pkg-config

cargo test works, and cargo run --example low_level_ocr_full_page works.

You'll need to give me more information about the problem if I'm going to be able to help you

andrewperoramas commented 5 months ago

does versions matter? tesseract 5.3.4 , leptonica-1.84.1