Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: converting to Vec<u8> or &[u8] or Vector<u8> for tesseract #15

Open
JulianWogersien opened this issue Oct 24, 2023 · 1 comment

Comments

@JulianWogersien
Copy link

The set_image_from_mem function in https://crates.io/crates/tesseract takes a &[u8].

@JulianWogersien
Copy link
Author

JulianWogersien commented Oct 24, 2023

if you must know, i tried to use the .data_typed function but i just get a pixReadMem error saying that the format is unknown and no pix was returned. this is a sample of the code i used the code i used

    let image = opencv::imgcodecs::imread("file.png", opencv::imgcodecs::IMREAD_COLOR).unwrap();
    
    let img: &[u8] = image.data_typed::<u8>().unwrap();

    let mut tess = Tesseract::new(None, Some("eng")).unwrap();
    tess = tess.set_image_from_mem(img).unwrap();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant