我在如下的build.gradle中添加了tess-two库
implementation 'com.rmtheis:tess-two:9.1.0'
我想用TessBaseApi()识别数学表达式,所以我需要设置真正的textord_equation_detect,但是我不知道该怎么做。我用TessBaseApi编写的代码如下
public static boolean init(AssetManager assetManager){
mTess = new TessBaseAPI();
String datapath = CommonUtils.APP_PATH;
File dir =new File(datapath + "tessdata/");
if(!dir.exists()) {
dir.mkdir();
try {
InputStream inStream = assetManager.open("CSDL/eng.traineddata");
FileOutputStream outStream = new FileOutputStream(datapath + "tessdata/eng.traineddata");
byte[] buffer = new byte[1024];
int readCount = 0;
while (((readCount = inStream.read(buffer)) != -1)) {
outStream.write(buffer, 0, readCount);
}
outStream.flush();
outStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
mTess.init(datapath,"eng");
return true;
}
如何设置真正的textord_equation_detect?你能帮我吗?
答案 0 :(得分:1)
mTess.SetVariable("textord_equation_detect", "T");