Merge pull request #2690 from vidiecan/master

Optional speed optimisation
This commit is contained in:
zdenop 2019-10-04 13:02:51 +02:00 committed by GitHub
commit 84c410a8e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -236,7 +236,9 @@ void Tesseract::LSTMRecognizeWord(const BLOCK& block, ROW *row, WERD_RES *word,
}
ImageData* im_data = GetRectImage(word_box, block, kImagePadding, &word_box);
if (im_data == nullptr) return;
lstm_recognizer_->RecognizeLine(*im_data, true, classify_debug_level > 0,
bool do_invert = tessedit_do_invert;
lstm_recognizer_->RecognizeLine(*im_data, do_invert, classify_debug_level > 0,
kWorstDictCertainty / kCertaintyScale,
word_box, words, lstm_choice_mode,
lstm_choice_iterations);

View File

@ -66,6 +66,8 @@ Tesseract::Tesseract()
BOOL_MEMBER(tessedit_dump_pageseg_images, false,
"Dump intermediate images made during page segmentation",
this->params()),
BOOL_MEMBER(tessedit_do_invert, true,
"Try inverting the image in `LSTMRecognizeWord`", this->params()),
// The default for pageseg_mode is the old behaviour, so as not to
// upset anything that relies on that.
INT_MEMBER(

View File

@ -790,6 +790,8 @@ class Tesseract : public Wordrec {
"Break input into lines and remap boxes if present");
BOOL_VAR_H(tessedit_dump_pageseg_images, false,
"Dump intermediate images made during page segmentation");
BOOL_VAR_H(tessedit_do_invert, true,
"Try inverting the image in `LSTMRecognizeWord`");
INT_VAR_H(tessedit_pageseg_mode, PSM_SINGLE_BLOCK,
"Page seg mode: 0=osd only, 1=auto+osd, 2=auto, 3=col, 4=block,"
" 5=line, 6=word, 7=char"