Skip to content

Commit

Permalink
Fix openalpr#641,openalpr#692 - Added support for tesseract version >…
Browse files Browse the repository at this point in the history
…=4.0.0
  • Loading branch information
engycz committed Jun 15, 2018
1 parent d25774c commit 28e0b0f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/openalpr/ocr/tesseract_ocr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ namespace alpr
std::cerr << "Expecting at least " << MINIMUM_TESSERACT_VERSION << ", your version is: " << tesseract.Version() << endl;
}

string TessdataPrefix = config->getTessdataPrefix();
if (cmpVersion(tesseract.Version(), "4.0.0") >= 0)
TessdataPrefix += "tessdata/";

// Tesseract requires the prefix directory to be set as an env variable
tesseract.Init(config->getTessdataPrefix().c_str(), config->ocrLanguage.c_str() );
tesseract.Init(TessdataPrefix.c_str(), config->ocrLanguage.c_str() );
tesseract.SetVariable("save_blob_choices", "T");
tesseract.SetVariable("debug_file", "/dev/null");
tesseract.SetPageSegMode(PSM_SINGLE_CHAR);
Expand Down

0 comments on commit 28e0b0f

Please sign in to comment.