I am making an Android OCR app using the tesseract tools. I have tried some of the links found online. However, for all them, my app crashes after
baseApi.init(DATA_PATH, lang)
I have tried all sorts of values for Data_Path found online. I have my eng.traineddata in assets/tessdata.
//DATA_PATH = Environment.getExternalStorageDirectory().toString() + "/MyOCRApp/tessdata";
AssetManager assetManager = getAssets();
String[] files = new String[0];
try {
files = assetManager.list("");
} catch (IOException e) {
e.printStackTrace();
}
for (String currPath:files){
if (currPath.equals("tessdata")){
DATA_PATH = "///android_asset/"+ currPath;
}
}
These are a couple of the examples I have tried using. Also, I don't think my app is installing in the SD card, it is installing in the internal memory. I hope that is not the issue.
The language data has to be on the device's storage, not inside the app assets.
So if you put it on the SD card in
/MyOCRApp/tessdata
you'd use: