1

I am using Tess-two to OCR documents.It seems that the team of Tesseract has done a great job and the results are extremely good!!
But now I want to use only words from my user_data file.
Here https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc#config-files-and-augmenting-with-user-data is a very good example. I have found every file in my android project that the link of Tesseract suggests but I cannot make the program use the words from user_data file. I have found the .bazaar file in the configs folder but how I set this in my code??
Is there something that I miss?

Below is the part of the code that I initialize the tessbaseApi and set the commands.

    TessBaseAPI baseApi = new TessBaseAPI();
    baseApi.setDebug(true);

    baseApi.init(Environment.getExternalStorageDirectory() + "/EMB/dataBase/", "eng");

    baseApi.setPageSegMode(TessBaseAPI.OEM_TESSERACT_CUBE_COMBINED);
    baseApi.setPageSegMode(TessBaseAPI.PageSegMode.PSM_AUTO_OSD);
    baseApi.setPageSegMode(TessBaseAPI.PageSegMode.PSM_SINGLE_LINE);


    baseApi.ReadConfigFile("/path/to/configs/bazaar");      

    baseApi.setImage(myBitmap);
    //variable for recognizing

    String recognizedText = baseApi.getUTF8Text();
    /*recognizedText = recognizedText.replaceAll(blackList, "");//remove space*/
    String resultTxt = recognizedText;
    //
    baseApi.end();
    ocrreadytext.setText(resultTxt);

Thanks in advance!

gmetax
  • 3,853
  • 2
  • 31
  • 45
Farmaker
  • 2,700
  • 11
  • 16
  • I used baseApi.ReadConfigFile(Environment.getExternalStorageDirectory() + "/EMB/dataBase/tessdata/" + "bazaar.txt"); Now the app sees config file but nothing happens. If I set an unknown command in bazaar file then app crashes....One step at a time – Farmaker Jan 03 '17 at 16:58

1 Answers1

0

Init-only parameters are not currently supported.

rmtheis
  • 5,992
  • 12
  • 61
  • 78