Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Could not initialize Tesseract API with language=eng! #48

Closed
raitono opened this issue May 19, 2014 · 4 comments
Closed

Could not initialize Tesseract API with language=eng! #48

raitono opened this issue May 19, 2014 · 4 comments

Comments

@raitono
Copy link

raitono commented May 19, 2014

I am getting the above error message when I try to use tess-two in my Android application. I am able use the Simple-Android-OCR application and I have used some of the code from it in my own application. This is where I try to initialize the API:

TessBaseAPI baseApi = new TessBaseAPI();
baseApi.setDebug(true);
baseApi.init(path.getAbsolutePath(), lang);

Here are the variables used:

public static File path = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
public static final String lang = "eng";

I don't know why I am getting this error and I don't know how to go about fixing it. I have done some searches but I didn't turn up anything useful. I did look at some of the source code and I saw where this error is printed, but I couldn't find the api.Init(c_dir, c_lang) method that it refers to. I would appreciate any help in tracking this error down.

@rmtheis
Copy link
Owner

rmtheis commented May 21, 2014

The path is for pointing to your data files. You must have a subdirectory
named "tessdata". See

* The datapath must be the name of the parent directory of tessdata and

.

On Mon, May 19, 2014 at 1:49 PM, Ben Painter notifications@github.comwrote:

I am getting the above error message when I try to use tess-two in my
Android application. I am able use the Simple-Android-OCR application and I
have used some of the code from it in my own application. This is where I
try to initialize the API:

TessBaseAPI baseApi = new TessBaseAPI();
baseApi.setDebug(true);
baseApi.init(path.getAbsolutePath(), lang);

Here are the variables used:

public static File path =
getExternalFilesDir(Environment.DIRECTORY_PICTURES);
public static final String lang = "eng";

I don't know why I am getting this error and I don't know how to go about
fixing it. I have done some searches but I didn't turn up anything useful.
I did look at some of the source code and I saw where this error is
printed, but I couldn't find the api.Init(c_dir, c_lang) method that it
refers to. I would appreciate any help in tracking this error down.


Reply to this email directly or view it on GitHubhttps://github.com//issues/48
.

@raitono
Copy link
Author

raitono commented May 21, 2014

I see. One of the portions of code I had copied was supposed to copy the contents of the tessdata directory from my assets folder. I had assumed it worked since I didn't get the error message "Data path must contain subfolder tessdata!" I'll look over that portion again and see if I messed it up.

@Chan2U
Copy link

Chan2U commented Jul 2, 2018

Have you solved it?

@raitono
Copy link
Author

raitono commented Jul 2, 2018

Considering this thread is 4 years old, I don't remember much about it. But it's safe to say no, I didn't since my project died.

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

No branches or pull requests

3 participants