【问题标题】:How can i set textord_equation_detect true in TessBaseApi in Android如何在 Android 的 TessBaseApi 中设置 textord_equation_detect 为真
【发布时间】:2020-04-07 18:33:32
【问题描述】:

我在 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?你能帮帮我吗?

【问题讨论】:

    标签: java android tesseract tess-two


    【解决方案1】:

    mTess.SetVariable("textord_equation_detect", "T");

    以下示例 https://github.com/tesseract-ocr/tesseract/issues/2204

    【讨论】:

    • 我试过这种方式。但没有任何区别。仍然无法识别数学符号,方程式。我不知道该怎么办
    • 这个标志可以让你进行方程检测,但不能对包含方程的区域进行 OCR。您只需确定方程所在的位置。所以我相信这个答案是正确的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-22
    • 2014-06-28
    相关资源
    最近更新 更多