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

eng.traineddata from tessdata_best on Android gives initialization error #49

Closed
Kunal-git opened this issue Mar 27, 2020 · 1 comment
Closed

Comments

@Kunal-git
Copy link

Kunal-git commented Mar 27, 2020

the eng.traineddata file from this tessdata_best directory doesn't work on Android platform. When tested on PC, everything works fine. But when testing on Android device, tesseract initialization fails with this error :
TessBaseAPIInit3 (tessHandle, dataPath, lang) != 0

Here is a sample code for my Tesseract Initialization function

public bool Init (string lang, string dataPath) {
	
		if (!tessHandle.Equals (IntPtr.Zero)) {
			Close ();
                }

		try {
			tessHandle = TessBaseAPICreate ();  

			if (tessHandle.Equals (IntPtr.Zero)) {
                                Debug.LogError("Initialization falied, tessHandle equals IntPtr.Zero");
				return false;
			}

			if (dataPath == null) {
                                if (!prepareTessdata(false)) {
                                        Debug.LogError("Initialization falied, dataPath issue");
                                        return false;
                                }
				dataPath = destPath;
			}
    
	                if(TessBaseAPIInit3(tessHandle,dataPath,lang) != 0) { 
				Close ();
                                Debug.LogError("Initialization failed, TessBaseAPIInit3()!=0");
				return false;
			}

                        Debug.Log("[TESSERACT] initialized successfully..");
		}
        catch (Exception ex) {
			Debug.Log("error : " + ex.Message);
		}
		return true;
	}

So far, eng.traineddata file from only tessdata directory seems to be working on Android platform, and those from "tessdata_best" & "tessdata_fast" repositories are giving this same error (tested only with english language).

@Kunal-git
Copy link
Author

The above mentioned issue is not directly caused by the traineddata file, but it arises when Traineddata file and tesseract are not compatible.
For more info, follow this thread.

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