This fixes a compiler warning:
api/baseapi.cpp:1621:17: warning:
variable 'font_name' set but not used [-Wunused-but-set-variable]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
The indentation is wrong since commit
fd0683f9e0 and results in a gcc warning:
api/baseapi.cpp: In member function 'bool tesseract::TessBaseAPI::ProcessPagesMultipageTiff(const l_uint8*, size_t, const char*, const char*, int, tesseract::TessResultRenderer*, int)':
api/baseapi.cpp:986:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (tessedit_page_number >= 0)
^~
api/baseapi.cpp:988:7: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
pix = (data) ? pixReadMemFromMultipageTiff(data, size, &offset)
^~~
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This information is not needed for normal runs, so it is sufficient
to show it on request (like versions and OpenCL information).
This also fixes a crash caused by undefined order of global constructors:
When the global variable SIMDDetect::detector is initialized before the
global variable debug_file, the first tprintf call in simddetect.cpp
crashes because of a NULL pointer in debug_file. This was only seen when
running with a shared library (libtesseract.so).
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Modify also the code to use a singleton. This simplifies the code as
no locking is needed. It also slightly improves the performance because
no check whether the architecture was tested is needed.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
They were removed in commit d70f3c3663.
The old code implicitly added `-llept` by using the `AC_CHECK_LIB` macro.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
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>
Takes advantage of inheritance and dir="ltr" default to:
- only generate paragraph dirs which are not ltr
- only generate word dirs which don't match enclosing paragraph
Tested against LTR, RTL, and mixed direction files. Files for the
latter two cases are in a separate commit on the ltr-test-files branch.
This fixes the duplicate line IDs caused by inserting height information
into the middle of the ID and it moves the line height info into
the title attribute like everything else, rather than using non-standard
HTML attributes (which won't validate).
This change may break consumers of the HTML output, but 3.04 has only
been in the wild for 6 months and the current HTML is invalid, so I
believe the benefit outweighs the cost for the fix.
Revert fd429c32, 43834da7, 05de195e.
See #49, #59.
The code in this commit solves the issue in a more elegant way, IMHO.
Now you can use:
* `tesseract eurotext.tif eurotext txt pdf`
* `tesseract eurotext.tif eurotext txt hocr`
* `tesseract eurotext.tif eurotext txt hocr pdf`
NOTE:
With `tesseract eurotext.tif eurotext`
or `tesseract eurotext.tif eurotext txt`
the psm will be set to '3', but...
With `tesseract eurotext.tif eurotext txt pdf`
or `tesseract eurotext.tif eurotext txt hocr`
the psm will be set to '1'.
Commit 99110df757 improved the help text
in several aspects, but also introduced new inconsistencies which this
patch tries to fix.
* Align columns (this needed replacing tabs by spaces).
* Start explaining text with uppercase.
* Replace "the stdout" by "stdout.
* Small changes in help text for page segmentation modes.
* Split options in OCR options and single options
(partially revert commit 99110df757).
In addition, whitespace characters at end of lines were removed.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity bug reports:
CID 1270405: Uninitialized scalar variable
CID 1270408: Uninitialized scalar variable
CID 1270409: Uninitialized scalar variable
CID 1270410: Uninitialized scalar variable
Those variables are set conditionally in the while loop
and must keep their values in following iterations, so
they must be declared outside of the loop.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
size_t is not always the same as long, especially not for 64 bit Windows:
api/pdfrenderer.cpp:549:31: warning:
format '%ld' expects argument of type 'long int',
but argument 4 has type 'size_t {aka long long unsigned int}' [-Wformat=]
size_t normally requires a format string "%zu", but this is unsupported
by Visual Studio, so use a type cast.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This fixes compiler warnings like this one:
api/baseapi.h:739:32: warning:
type qualifiers ignored on function return type [-Wignored-qualifiers]
Signed-off-by: Stefan Weil <sw@weilnetz.de>