Open Godnoken opened 1 year ago
Looking at tesseract's source code, I see this write_images
variable is only used in one place: in ProcessPage.
I suspect this isn't called indirectly by any method we currently expose as it requires a filename.
Probably the only way to make TesseditWriteImages
write an image is to use that method.
We don't currently support it here, but it is exposed in the sys crate (unsafe).
You could call it from Rust using that.
If it's just for some debugging, it may be easier to use the command line version of tesseract.
Sorry it's not the most helpful answer,
Chris
Looking at tesseract's source code, I see this
write_images
variable is only used in one place: in ProcessPage.I suspect this isn't called indirectly by any method we currently expose as it requires a filename.
Probably the only way to make
TesseditWriteImages
write an image is to use that method.We don't currently support it here, but it is exposed in the sys crate (unsafe).
Ah.. Thank you for that, I have no experience in C++ so it is a little bit troublesome to go through that codebase.
I assume I will have to ditch the LepTess crate and go with the sys crates. Speaking of them, can I work in between them or should I be using leptess::capi instead?
If it's just for some debugging, it may be easier to use the command line version of tesseract.
I need this for user debugging as well as for my own immediate feedback on certain things, but thank you.
Sorry it's not the most helpful answer,
No no, it's very helpful. I appreciate the quick response too!
By the way, how come thresholding_method and others are not exposed in the sys crate?
Or do I need to use tesseract_sys::TessBaseAPISetVariable or similar?
Speaking of them, can I work in between them or should I be using leptess::capi instead?
leptess::capi
should work fine.
I assume I will have to ditch the LepTess crate and go with the sys crates.
I'm not sure how much you'll be able to mix and match. By the time you're using the sys crate the higher level abstraction may not be that useful to you.
By the way, how come thresholding_method and others are not exposed in the sys crate?
I'm also not familiar with c++ 😅
We mostly only take functions and constants defined in tesseract's c-api. I believe it is possible to use a c++ API from rust, but it uses different techniques. We do import some constants from the C++ API, and could maybe import more. It looks like the thresholding_method
and related constants are actually classes, so may be more complicated.
I'm not sure how much you'll be able to mix and match. By the time you're using the sys crate the higher level abstraction may not be that useful to you.
Fair do's, I'll just go with the capi then.
We mostly only take functions and constants defined in tesseract's c-api. I believe it is possible to use a c++ API from rust, but it uses different techniques. We do import some constants from the C++ API, and could maybe import more. It looks like the
thresholding_method
and related constants are actually classes, so may be more complicated.
Ah, of course.. I should have picked that up. I did actually try to use bindgen & other crates to be able to call Tesseract functions from Rust before I found LepTess. Safe to say I took a lot of water over my head on that one. 😅
I definitely believe the capi is more than enough for most cases, but it would be nice to have near to full control at some point. My only real concern at this moment is that it seems that Tesseract still uses the legacy otsu threshold by default. However, I guess it isn't really an issue at the end of the day if I just feed in images that have already been through binarization.
Hi there!
I'm trying to get the preprocessed image from Tesseract by setting TesseditWriteImages to true like so;
I believe this is correct. Now the issue is that I do not know exactly where the image goes.. It seems like it should be the current directory from what I've gathered from the Tesseract GitHub repo, but nothing shows up.
I'm using
tessapi.get_utf8_text().unwrap()
and I have also triedtessapi.recognize()
to see if it pops up then, but so far no success.Cheers!