Skip to content

Commit

Permalink
Allow orientation detection with any traineddata
Browse files Browse the repository at this point in the history
While orientation and script detection (OSD) normally requires
osd.traineddata to detect both, it must also be possible to do
only orientation detection with eng.traineddata or any other
traineddata.

Enforce osd.traineddata only if there was no `-l` command line option.

Commit 27ce472 was too restrictive.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Oct 4, 2018
1 parent 6b9f1f1 commit 26bfd2b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/api/tesseractmain.cpp
Expand Up @@ -367,11 +367,15 @@ static void ParseArgs(const int argc, char** argv, const char** lang,
*arg_i = i;

if (*pagesegmode == tesseract::PSM_OSD_ONLY) {
// That mode requires osd.traineddata, no other language or script files.
// OSD = orientation and script detection.
if (*lang != nullptr && strcmp(*lang, "osd")) {
fprintf(stderr, "Warning, ignoring -l %s for --psm 0\n", *lang);
// If the user explicitly specifies a language (other than osd)
// or a script, only orientation can be detected.
fprintf(stderr, "Warning, detects only orientation with -l %s\n", *lang);
} else {
// That mode requires osd.traineddata to detect orientation and script.
*lang = "osd";
}
*lang = "osd";
}

if (*outputbase == nullptr && noocr == false) {
Expand Down

0 comments on commit 26bfd2b

Please sign in to comment.