Как я могу установить true для textord_equation_detect в TessBaseApi в Android - PullRequest
0 голосов
/ 07 апреля 2020

Я добавил библиотеку tess-two в build.gradle, как показано ниже

        implementation 'com.rmtheis:tess-two:9.1.0'

, и я хочу распознать математическое выражение, символ с помощью TessBaseApi (), поэтому мне нужно установить true 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;
}

Как я могу установить true textord_equation_detect? Можете ли вы помочь мне, пожалуйста?

1 Ответ

1 голос
/ 08 апреля 2020

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

в следующих примерах https://github.com/tesseract-ocr/tesseract/issues/2204

...