0

I added tess-two library in build.gradle like below

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

and I want to recognize mathematical expression,symbol with TessBaseApi() so i need set true textord_equation_detect but i don't know how to do this.The code I wrote using TessBaseApi is as follows

    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;
}

How can i set true textord_equation_detect? Can you help me please?

1 Answers1

1

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

following examples in https://github.com/tesseract-ocr/tesseract/issues/2204

nguyenq
  • 8,212
  • 1
  • 16
  • 16
  • I tried in this way.But there was no difference.Still don't recognize math symbols,equations.I don't know what to do – sedaylmz64 Apr 07 '20 at 23:05
  • 1
    This flag gets you equation detection but not OCR of the equation-containing regions. You just get the identification of where the equations are. So I believe this answer is correct as-is. – rmtheis Apr 14 '20 at 22:59