I am developing an Android ocr app with the tess-two library. While testing I manually copied the tessdata folder in my test device but now I need a programmatically way to do it. How the other apps do? Is it necessary to copy the folder or can I do in other ways? Thank you
Asked
Active
Viewed 684 times
1 Answers
2
You can do this programmatically. I would advice you give you android app Permission to access the phones memory so that you can copy this data on load.
here is a sample code I used for a project
protected static final String PHOTO_TAKEN = "photo_taken";
path = DATA_PATH + "ocr.jpg";
String[] paths = new String[] { DATA_PATH, DATA_PATH + "tessdata/" };
for (String path : paths) {
File dir = new File(path);
if (!dir.exists()) {
if (!dir.mkdirs()) {
Log.v(TAG, "ERROR: Creation of directory " + path + " on sdcard failed");
return;
} else {
Log.v(TAG, "Created directory " + path + " on sdcard");
}
}
}