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

Which method returns text orientation? #44

Open
atgorvi opened this issue May 26, 2022 · 5 comments
Open

Which method returns text orientation? #44

atgorvi opened this issue May 26, 2022 · 5 comments

Comments

@atgorvi
Copy link

atgorvi commented May 26, 2022

There is mode "Orientation and script detection only. PSM_OSD_ONLY" in TessBaseAPI, which method returns text orientation
OSD_Issue
?

@Robyer
Copy link
Member

Robyer commented May 26, 2022

I don't think result of this mode (as many other things) is exposed in the Java API. You may need to see how it's accessed in the C++ code and expose it for yourself by modifying the library.

So, cpp files in tesseract4android/src/main/cpp/tesseract and java files in tesseract4android/src/main/java/com/googlecode/tesseract/android must be modified/added.

@chilex111
Copy link

Hi, I want to pass in an image captured from the camera of the device, but when I do that, I don't get the text at all, the only time I get the right text is if I save the image in the asset folder or I pick it from the gallery.
Please how can I get this to work for the camera photo?

@Robyer
Copy link
Member

Robyer commented Mar 8, 2023

@chilex111 Hi, you are writing comment to completely unrelated issue. Also, for such questions you should use StackOverflow and not Github issues.

I will just say here that generally you should convert the image you get from Camera into standard Bitmap and then give that to Tesseract by calling setImage(bitmap). There is no direct support for giving the Image object which you receive from Camera2 API directly to Tesseract.

@john-khgoh
Copy link

@Robyer I believe this feature has now been added to tesseract-ocr: tesseract-ocr/tesseract#4070

@Robyer
Copy link
Member

Robyer commented Sep 1, 2024

@john-khgoh That is separate feature. There is no issue in Tesseract itself, current version of this (Tesseract4Android) library just doesn't expose the full Tesseract's C/C++ API to Java. It's because I directly used the same Java API from tess-two project and kept it (mostly) as is.

It's possible to expose more methods/features from Tesseract, or even create a completely new API at Java side, but I just didn't have the need for that on my own.

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

4 participants