diff --git a/Makefile.am b/Makefile.am index f9c48dea43..b0e0baeeb8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -734,10 +734,15 @@ bin_PROGRAMS = tesseract tesseract_SOURCES = src/tesseract.cpp tesseract_CPPFLAGS = tesseract_CPPFLAGS += -I$(top_srcdir)/src/arch +tesseract_CPPFLAGS += -I$(top_srcdir)/src/ccmain tesseract_CPPFLAGS += -I$(top_srcdir)/src/ccstruct tesseract_CPPFLAGS += -I$(top_srcdir)/src/ccutil +tesseract_CPPFLAGS += -I$(top_srcdir)/src/classify +tesseract_CPPFLAGS += -I$(top_srcdir)/src/cutil tesseract_CPPFLAGS += -I$(top_srcdir)/src/dict +tesseract_CPPFLAGS += -I$(top_srcdir)/src/textord tesseract_CPPFLAGS += -I$(top_srcdir)/src/viewer +tesseract_CPPFLAGS += -I$(top_srcdir)/src/wordrec if OPENCL tesseract_CPPFLAGS += -I$(top_srcdir)/src/opencl endif diff --git a/src/tesseract.cpp b/src/tesseract.cpp index e0697aa77f..480815564c 100644 --- a/src/tesseract.cpp +++ b/src/tesseract.cpp @@ -39,6 +39,7 @@ #endif #include #include "simddetect.h" +#include "tesseractclass.h" // for AnyTessLang #include "tprintf.h" // for tprintf #ifdef _OPENMP @@ -787,6 +788,12 @@ int main(int argc, char **argv) { (api.GetBoolVariable("tessedit_make_boxes_from_boxes", &b) && b) || (api.GetBoolVariable("tessedit_train_line_recognizer", &b) && b); + if (api.GetPageSegMode() == tesseract::PSM_OSD_ONLY) { + if (!api.tesseract()->AnyTessLang()) { + fprintf(stderr, "Error, OSD requires a model for the legacy engine\n"); + return EXIT_FAILURE; + } + } #ifdef DISABLED_LEGACY_ENGINE auto cur_psm = api.GetPageSegMode(); auto osd_warning = std::string("");