java - 如何在 Android 的 TessBaseApi 中设置 textord_equation_detect 为真
问题描述
我在 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?你能帮我吗?
解决方案
mTess.SetVariable("textord_equation_detect", "T");
以下示例在 https://github.com/tesseract-ocr/tesseract/issues/2204
推荐阅读
- java - 为什么在类文件中使用 PageFactory initElements 一次会报错
- git - 切换分支时机器崩溃
- javascript - 将对象推送到对象数组中的对象数组上
- combinations - 大小为 k 的子集的时间分析
- python - Spotify API {'error': 'invalid_client'} 授权代码流程 [400]
- node.js - chrome自动填充的垫子自动完成问题
- awk - 用于最小值和最大值的 awk 代码中的变量
- python - 匹配两个csv文件之间的数据并替换数据
- c - 2 的幂的整数的二进制表示
- python - 使用 Keras Python 塑造 LSTM 模型的输入