- language data file download
https://github.com/tesseract-ocr/tessdata
- Gradle
dependencies { ... compile 'com.rmtheis:tess-two:5.4.1'}
- Permission
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
- language data file
1. set langage data file in assets
2. copy language data file to external storage (in code)
(must under subfolder tessdata)
val tdataPath = File(dataFolder.absoluteFile.toString() + "/eng.traineddata")
val input = assets.open("eng.traineddata"); val output = FileOutputStream(tdataPath) try{ input.copyTo(output) }catch(e : Exception){}
- module init
mTess.init(datafolder, "eng")
datafolder : set folder path exist tessdata folder
ref : https://qiita.com/Nunocky/items/35770ffc719d55ba0078
댓글
댓글 쓰기