Skip to content

Commit

Permalink
Merge pull request #1944 from stweil/psm
Browse files Browse the repository at this point in the history
Allow orientation detection with any traineddata
  • Loading branch information
egorpugin authored Oct 4, 2018
2 parents 6b9f1f1 + 26bfd2b commit a86292b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/api/tesseractmain.cpp
Original file line number Diff line number Diff line change
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 a86292b

Please sign in to comment.