我正在开发android应用程序。 我需要的是直接路径到训练数据文件(初始化tesseract)。 看起来最好的选择是设置原始资源。为tesseract-android-tools加载traineddata(android)
我得到资源ID这样(文件名是:deu.traineddata):
int rID = resources.getIdentifier("deu", "raw", "my.code.package");
OK, '摆脱'> 0,现在越来越流:
InputStream is = resources.openRawResource(rID);
OK“是'!= null。 但现在越来越问题,通过阅读“是” IOException异常已经扔了,不带堆栈跟踪:
byte[] bytes = new byte[is.available()];
is.read(bytes);
我也尝试读取从资产文件,但通过从InputStream里读入同样的问题。 什么我做错了,是否有任何其他方式来获取资源路径? thanx andrej
经过一些尝试没有工作,所以我下载traineddata直接从tesseract server.Thanx任何方式。 – andrej