Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tesseract api with load_system_dawg and load_freq_dawg

Tags:

c++

tesseract

How to set load_system_dawg and load_freq_dawg to false ??

I need to disable the dictionary.. So I guess these are the two parameteres I need to set to false?

tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
if(api->Init(NULL, "dan+eng")){
    // error
}
api->SetImage(image);
api->Recognize(0);

tesseract 3.05.01

like image 657
clarkk Avatar asked Oct 17 '25 10:10

clarkk


1 Answers

  1. In your tessdata directory create a configs directory
  2. Create a file config (you will pass name of config file later in code)
  3. Fill your config file with following text
load_system_dawg     F    
load_freq_dawg       F
  1. Modify your code

    auto     numOfConfigs = 1;
    auto     **configs    = new char *[numOfConfigs];
    configs[i] = (char *) "name of your config file";
    
    tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
    if(api->Init(NULL, "dan+eng", tesseract::OEM_DEFAULT, configs, numOfConfigs, nullptr, nullptr, false)){
        // error
    }
    

P.S. It is also possible to do with last couple of arguments of Init function, feel free to try them out yourself.

like image 50
Dmitrii Z. Avatar answered Oct 18 '25 23:10

Dmitrii Z.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!