See issue #424.
The existing C API for TessBaseAPIDetectOS requires a C caller to successfully allocate struct OSResults which is actually a C++ class. Generally it won't
be possible for a regular C compiler to do this properly.
It's also assumed that most API level users of Tesseract are only interested in Tesseract's best guess as to script and orientation, not the individual values for all possible scripts.
This introduces a new API with a better name that is more closely aligned with the output of 'tesseract -psm 0'. Both tesseract -psm 0 and this API now share the same code in baseapi.cpp.
Builds without support for OpenMP failed with the old code. Fix this:
* Add OPENMP_CXXFLAGS for ccmain.
* Replace unconditional -fopenmp by OPENMP_CXXFLAGS for lstm.
* Always use _OPENMP for conditional compilation.
* Remove OPENMP as there is already _OPENMP.
* Include omp.h conditionally.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
clang++ report:
api/baseapi.h:852:4: warning:
extra ';' after member function definition [-Wextra-semi]
[...]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
It was introduced recently in commit f24ef67d, so there is no need
to support the old variant for compatibility reasons.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Calling TessBaseAPI::Clear() which calls TessBaseAPI::ClearResults()
which calls SavePixForCrash(0, NULL) is needed to release objects
allocated in global_crash_pixes.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
When exit() is called from ParseArgs(), no destructors are executed
for the auto variables vars_vec and vars_values.
Making both variables static fixes the memory leaks, because now the
destructors are always executed.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This fixes a compiler warning:
api/baseapi.cpp:1743:11: warning:
unused variable 'kBytesPerBlob' [-Wunused-const-variable]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
It conflicts with a previous 'class' declaration for ETEXT_DESC:
include/tesseract/baseapi.h:594:21:
Struct 'ETEXT_DESC' was previously declared as a class
Signed-off-by: Stefan Weil <sw@weilnetz.de>
The previous commit added a dependency on tiffio.h, so enable the new
code only if that file is available.
The code which conditionally defines HAVE_TIFFIO_H was already there
although that macro was unused up to now.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Showing them in a window (default) is not acceptable for a console
application like Tesseract which must be able to work in batch mode.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
In Tesseract's coordinate system, width is just right - left, cf. slide #2 of
github.com/tesseract-ocr/docs/blob/master/das_tutorial2016/2ArchitectureAndDataStructures.pdf
It is common practice for command line programs to print
user requested information on stdout.
This seems to be reasonable for Tesseract, too.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
It is common practice for command line programs to show help text
on stdout. This seems to be reasonable for Tesseract, too.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Most command line programs print the version to stdout.
This seams to be reasonable for Tesseract, too.
Now a shell statement like "VERSION=$(tesseract --version)" works
without I/O redirection.
Signed-off-by: Stefan Weil <sw@weilnetz.de>