Stefan Weil
6a0f8e8c07
ColPartition: Rename median_size_ -> median_height_
...
This implements a TODO. Rename also some related items.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-03 08:46:38 +02:00
Stefan Weil
8af80b7ba6
Fix ImageThresholder::OtsuThresholdRectToPix for OpenCL
...
The ThresholdRectToPix OpenCL kernel only supports 4 channels.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-01 22:49:28 +02:00
zdenop
c044b8c916
Merge pull request #1818 from stweil/psm
...
Fix potential crash with --psm 0 and use osd.traineddata automatically
2018-08-01 16:56:56 +02:00
zdenop
d22ca6bb06
Merge pull request #1817 from noahmetzger/winfix
...
Fix issue detected by Coverity Scan
2018-08-01 16:55:56 +02:00
Stefan Weil
27ce472666
Fix potential crash with --psm 0 and use osd.traineddata automatically
...
Page segmentation mode "OSD only" requires osd.traineddata,
so use it automatically.
Report a warning if the user specified a different language.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-01 16:52:37 +02:00
Noah Metzger
65997bed16
Fix issue detected by Coverity Scan
...
CID: 1340285 (Division or modulo by zero)
Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
2018-08-01 15:56:19 +02:00
zdenop
b23568f3d1
Merge pull request #1816 from noahmetzger/winfix
...
Fix issues detected by Coverity Scan
2018-08-01 14:45:00 +02:00
Noah Metzger
d28631a274
Fix issues detected by Coverity Scan
...
CID: 1164604 (Nesting level does not match indentation)
Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
2018-08-01 14:30:13 +02:00
Stefan Weil
6a28cce96b
Fix whitespace issues
...
* Remove whitespace (blanks, tabs, cr) at line endings
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-01 13:19:52 +02:00
zdenop
3af2773d0e
Merge pull request #1814 from noahmetzger/winfix
...
Fix issue detected by Coverity Scan
2018-08-01 11:20:13 +02:00
Noah Metzger
2d96c66126
Fix issue detected by Coverity Scan
...
CID: 1164533 (Logically dead code)
Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
2018-08-01 10:30:52 +02:00
Stefan Weil
eb69dd0201
TessPDFRenderer: Improve robustness of API (issue #1804 )
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-01 09:11:04 +02:00
Egor Pugin
9ce4d05188
Merge pull request #1812 from noahmetzger/winfix
...
Fix issue reported by Coverity Scan
2018-07-31 13:52:05 +03:00
Noah Metzger
d4490af06d
Fix issue reported by Coverity Scan
...
CID: 1375395 (Dereference after null check)
Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
2018-07-31 10:43:39 +02:00
zdenop
7d99cb4e28
Merge pull request #1811 from noahmetzger/winfix
...
Fix issue reported by Coverity Scan
2018-07-31 09:53:33 +02:00
Noah Metzger
83a4eb3b44
Fix issue reported by Coverity Scan
...
CID: 1391264 (Improper use of negative value)
Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
2018-07-31 09:43:30 +02:00
Stefan Weil
9cf170cb7a
Revert "Change default width for images output by text2image"
...
This reverts commit fdc243b363
because
it caused a regression reported in issue #1798 .
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-27 07:29:30 +02:00
Stefan Weil
b19e69086c
training: Add new flag --workspace_dir to tesstraining_utils.sh
...
By default, that script creates two new temporary directories with random
names in /tmp.
The new command line flag --workspace_dir PATH uses the given path as
a base directory for all temporary files.
That allows better reproducable training results (no random directory
names in log files).
Signed-off-by: Stefan Weil <stweil@ub-backup.bib.uni-mannheim.de>
2018-07-26 17:14:19 +02:00
Noah Metzger
91c7504a35
Added a feature to enrich the hOCR output with glyph confidences
...
By using the parameter -c glyph_confidences=true the user is able to enrich
the hOCR output with additional information. Tesseract then lists additionally
the timesteps with all glyphs that were considered with their confidence
for every timestep of the LSTM.
The format of the hOCR output is slightly changed: There is now a linebreak
after every word for better readability by humans.
Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
2018-07-25 18:18:58 +02:00
Stefan Weil
132c540c85
Increase limit for deserialization of large arrays
...
The last limit was still too small.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-21 11:10:09 +02:00
Stefan Weil
f577e292c2
Increase limit and add assertions for deserialization of large arrays
...
One of the checks was too restrictive, as lstmeval deserializes
char arrays with 14000000 elements, so raise the limit to 30000000.
That check was added in commit 992031e824
.
Add also assertions which help finding such problems in debug mode.
Signed-off-by: Stefan Weil <stweil@ub-backup.bib.uni-mannheim.de>
2018-07-20 11:47:49 +02:00
Stefan Weil
ca25d88538
Add missing execute permission for script files
...
It is needed for running the training tutorial on Linux.
The correct mode was lost when moving the files in
commit 104fe7931c
.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-19 20:25:41 +02:00
Stefan Weil
b7b8dba5db
LSTMTrainer: Use new serialization API
...
Improve also portability by using int32_t instead of int
for a serialized member variable.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 19:28:05 +02:00
Stefan Weil
1dcda1aa8a
LSTMRecognizer: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 19:28:05 +02:00
Stefan Weil
45a7ccf2d2
LSTM: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 19:28:05 +02:00
Stefan Weil
f4449ba41a
Convolve: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 19:28:05 +02:00
Stefan Weil
dfc3e9691f
SquishedDawg: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 19:28:05 +02:00
Stefan Weil
6cf508960a
UnicharAndFonts, Shape: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 17:31:37 +02:00
Stefan Weil
07b363fec0
MasterTrainer: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 17:29:10 +02:00
Stefan Weil
88b3d940be
TessdataManager: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 17:28:13 +02:00
Stefan Weil
da0217fa75
STRING: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 17:17:22 +02:00
Stefan Weil
5e05f2cb84
IndexMap: Use new serialization API and optimize code
...
By changing the type of sparse_size_ from int to int32_t,
a local copy can be removed.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 17:12:44 +02:00
Stefan Weil
edff1d1882
BitVector: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 17:07:03 +02:00
Stefan Weil
bb6c0123cc
ICOORD: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 17:02:12 +02:00
Stefan Weil
66bc012d27
UNICHARSET: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 16:22:02 +02:00
Stefan Weil
eb90068b5f
RecodedCharID: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 16:22:01 +02:00
Stefan Weil
0ca7cdd2c8
WordFeature, ImageData: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 16:22:01 +02:00
Stefan Weil
7133a6f43c
GENERIC_2D_ARRAY: Use new serialization API
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 16:22:01 +02:00
Stefan Weil
ea660f83a3
fontinfo: Use new serialization API and optimize code
...
Combine several calls of Serialize in write_spacing_info and in write_set.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 16:22:01 +02:00
zdenop
daba37f4d4
Merge pull request #1784 from stweil/serialize
...
Simplify API for serialization and add first users
2018-07-18 15:54:05 +02:00
Stefan Weil
6ef267c432
Use TFile::Serialize, TFile::DeSerialize
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 11:19:37 +02:00
Stefan Weil
c383b1aaca
TFile: Add helper functions for serialization of simple data types
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 11:19:37 +02:00
Stefan Weil
bdd2a7aedc
Use tesseract::Serialize, tesseract::DeSerialize
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 11:19:37 +02:00
Stefan Weil
16832f9878
Add helper functions for serialization of simple data types
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 11:19:37 +02:00
Stefan Weil
216c2b31e7
Fix typo and add TODO comment
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 09:58:39 +02:00
Stefan Weil
2b6a356cba
IntFeatureSpace: Remove unused DeSerialize method
...
The Serialize method is used indirectly by MasterTrainer::Serialize,
but there is no corresponding MasterTrainer::DeSerialize.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-18 09:56:43 +02:00
Stefan Weil
cfd72ff31e
Fix --print-parameters (regression)
...
Commit 629ded223c
had broken that
functionality.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-09 14:42:48 +02:00
Stefan Weil
88ebfea4b5
opencl: Fix crash and clean code a bit
...
OpenclDevice::getDeviceSelection crashed when outdated information
was read from file and device.score was not set.
Change also the struct definitions from C to C++ and
eliminate some type casts.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-08 18:38:11 +02:00
zdenop
e9cd6024d7
Merge pull request #1767 from stweil/unused
...
Remove unused macros and fix comments
2018-07-07 21:55:17 +02:00
Stefan Weil
0d4975933e
Replace tprintf_internal by tprintf and clean tprintf code
...
Commit 4d514d5a60
introduced tprintf_internal
with an additional argument "level" which was removed again in commit
7dc5296fe9
.
So we can now restore the original state without tprintf_internal.
Remove also the declaration of debug_window_on (it does not exist since
commit 030aae9896
) and make the
configuration parameter debug_file local as it is only used by tprintf.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 21:47:10 +02:00
Stefan Weil
24bf8c334c
Add include statements (needed for following commit)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 21:46:58 +02:00
Stefan Weil
8bd9567355
Fix some comments
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 21:19:01 +02:00
Stefan Weil
44415a706e
Remove unused EXTERN macros
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 21:19:01 +02:00
Stefan Weil
7e80a850ad
Remove unused macros
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 21:19:01 +02:00
Stefan Weil
609edd4600
Add missing include statement
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 21:19:00 +02:00
Stefan Weil
55f0ca5842
Add missing include statements and clean some include statements
...
The changes are based on an analysis done with include-what-you-use.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-07 16:24:53 +02:00
zdenop
71bb9c373b
Merge pull request #1761 from srdg/patch-1
...
Fixed "Invalid F spec" error while building FullyConnected layer.
2018-07-06 22:11:36 +02:00
Stefan Weil
0eb239ee8b
Fix typo in comments
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 22:00:00 +02:00
Soumik Ranjan Dasgupta
001f536c16
Fixed "Invalid F spec" error while building FullyConnected layer.
...
`int depth = strtol(*str + 1, str, 10);`
`**str` holds the words in the VGSL specification, and `*str` holds a single word, lets say, `Fr64`. Now, the `strtol` function modifies `str` to point to the first character which a non-digit number, and assumes that ` *str+1 ` points to a number (of valid integer format) as a string (automatically skipping all the white spaces, and no other characters), where in reality, it seems to point to `r` in `Fr164`.This is a bad argument, which results in strtol returning 0.
` strtol (*str + 2, str, 10)` should be passed instead.
2018-07-06 23:54:22 +05:30
Stefan Weil
18edac4086
Fix CID 1164623 (Uninitialized scalar field)
...
Fix it by combining constructor and Init method.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 17:34:46 +02:00
Stefan Weil
66b71e6b58
Fix CID 1164621 (Uninitialized scalar field)
...
Format also some comments.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 17:12:12 +02:00
Stefan Weil
8582ee097c
Fix CID 1164618 (Uninitialized scalar field)
...
Fix it by combining constructor and Init method.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 17:02:50 +02:00
Stefan Weil
37f82824f5
Fix CID 1164616 (Uninitialized scalar field)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 17:02:50 +02:00
Stefan Weil
430dc5c0b6
Fix CID 1164612 (Uninitialized scalar field)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 17:02:50 +02:00
Stefan Weil
19a99450bc
Fix CID 1164611 (Uninitialized scalar field)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 17:02:50 +02:00
Stefan Weil
4bb41b8952
Fix CID 1164693 (Untrusted value as argument)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 16:11:29 +02:00
Stefan Weil
992031e824
Fix CID 1164702 (Untrusted value as argument)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 16:11:29 +02:00
Stefan Weil
c1da5fbac4
Fix CID 1164704 (Untrusted value as argument)
...
Limit the matrix to UINT16_MAX x UINT16_MAX.
Larger dimensions could also result in an arithmetic overflow
when multiplying the two dimensions.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 16:11:29 +02:00
Stefan Weil
8871f4d622
Fix CID 1164686 (Use of untrusted scalar value)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 16:11:29 +02:00
Stefan Weil
92e2ad0471
Fix CID 1164703 (Untrusted value as argument)
...
Wrong file data could give a large value for the number of vector elements
resulting in very large memory allocations.
Limit the allowed data range to UINT16_MAX (65535) elements
which hopefully should be sufficient for all use cases.
Changing the data type of the related member variables from int to
uint32_t allowed removing several type casts.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-06 16:11:10 +02:00
Egor Pugin
a078ce02bb
Merge pull request #1756 from stweil/cov
...
Fix two issues reported by Coverity Scan
2018-07-05 23:10:39 +03:00
Stefan Weil
bfe2a79502
Fix CID 1164566 (Dereference after null check)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 22:07:36 +02:00
Stefan Weil
036c72ca2f
Fix CID 1164733 (Resource leak)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 22:07:36 +02:00
Stefan Weil
8d60a1849c
Remove unused iterator
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 21:20:27 +02:00
Egor Pugin
3ea9cff149
Merge pull request #1752 from stweil/api
...
API fixes
2018-07-05 17:28:48 +03:00
Egor Pugin
09f4179e89
Merge pull request #1754 from stweil/fix
...
Fix compiler warnings [-Wmissing-prototypes]
2018-07-05 17:28:36 +03:00
Stefan Weil
d2febafdcd
Fix compiler warnings [-Wmissing-prototypes]
...
Add missing include statements, add missing "static" qualifiers or
remove functions which are not used at all.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 16:03:02 +02:00
Stefan Weil
8ad7f049ea
Fix empty statements
...
* Add break in default case to avoid potential problems with
future case statements following the default case.
* Remove empty statement.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 15:17:54 +02:00
Stefan Weil
ffb501936c
Fix prototype for API function TessBaseGetBlockTextOrientations
...
The declaration did not match the implementation (BOOL / bool).
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 14:49:48 +02:00
Stefan Weil
790b410fd6
Remove unused API function TessBaseAPIDetectOS
...
It was not declared in capi.h, so external users could not use it anyway.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 14:49:48 +02:00
Stefan Weil
f107f116d9
Fix compiler warnings [-Wconditional-uninitialized]
...
clang warnings:
src/ccstruct/coutln.cpp:231:15: warning:
variable 'destindex' may be uninitialized when used here [-Wconditional-uninitialized]
src/wordrec/language_model.cpp:1170:27: warning:
variable 'expected_gap' may be uninitialized when used here [-Wconditional-uninitialized]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 12:07:04 +02:00
Stefan Weil
a74d467e90
Fix compiler warnings [-Wcomma]
...
clang warnings:
src/api/baseapi.cpp:1642:18: warning:
possible misuse of comma operator here [-Wcomma]
src/api/baseapi.cpp:1642:31: warning:
possible misuse of comma operator here [-Wcomma]
src/api/baseapi.cpp:1642:45: warning:
possible misuse of comma operator here [-Wcomma]
src/api/baseapi.cpp:1652:16: warning:
possible misuse of comma operator here [-Wcomma]
src/api/baseapi.cpp:1652:30: warning:
possible misuse of comma operator here [-Wcomma]
src/api/baseapi.cpp:1662:17: warning:
possible misuse of comma operator here [-Wcomma]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 12:07:04 +02:00
Stefan Weil
296a836f4e
Fix compiler warnings [-Wunused-const-variable]
...
clang warnings:
src/classify/trainingsampleset.cpp:39:11: warning:
unused variable 'kMinOutlierSamples' [-Wunused-const-variable]
src/lstm/lstmrecognizer.cpp:45:11: warning:
unused variable 'kMaxChoices' [-Wunused-const-variable]
src/training/dawg2wordlist.cpp:28:11: warning:
unused variable 'kDictDebugLevel' [-Wunused-const-variable]
src/training/stringrenderer.cpp:50:21: warning:
unused variable 'kWordJoiner' [-Wunused-const-variable]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 12:07:04 +02:00
Stefan Weil
787bde5630
Fix syntax errors introduced by last commit (regression)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-05 07:34:04 +02:00
Stefan Weil
d960a50c12
Fix compiler warning [-Wshadow-field-in-constructor]
...
clang warning:
src/ccstruct/polyblk.cpp:48:36: warning:
constructor parameter 'box' shadows the field 'box' of 'POLY_BLOCK'
[-Wshadow-field-in-constructor]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-04 21:58:33 +02:00
Stefan Weil
c1be1024be
Fix compiler warning [-Wtautological-undefined-compare]
...
clang warning:
src/lstm/networkio.cpp:56:15: warning:
'this' pointer cannot be null in well-defined C++ code;
comparison may be assumed to always evaluate to true [-Wtautological-undefined-compare]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-04 21:58:33 +02:00
Stefan Weil
52d392da50
Fix compiler warning [-Wunused-function]
...
clang warning:
src/lstm/lstmrecognizer.cpp:411:13: warning:
unused function 'NullIsBest' [-Wunused-function]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-04 21:58:33 +02:00
Stefan Weil
6cc35646f8
Fix compiler warning [-Wunreachable-code-break]
...
clang warning:
src/lstm/network.cpp:249:7:
warning: 'break' will never be executed [-Wunreachable-code-break]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-04 21:58:33 +02:00
Stefan Weil
bdf09f40b1
Fix compiler warnings [-Wzero-as-null-pointer-constant]
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-04 20:40:56 +02:00
Stefan Weil
60fcff5ed9
Fix build with legacy engine disabled (part 2)
...
The functions TessBaseAPIInitLangMod, TessBaseAPIClearAdaptiveClassifier
and TessBaseAPIDetectOrientationScript need conditional compilation.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-04 17:56:42 +02:00
Stefan Weil
081793ff48
Fix build with legacy engine disabled
...
Instead of defining the DISABLED_LEGACY_ENGINE macro in config_auto.h
(which is not included by all source files), define it as a preprocessor
option for those parts of the code which require it.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-04 17:56:42 +02:00
zdenop
20e53b119a
Merge pull request #1742 from stweil/casts
...
Remove unneeded type casts
2018-07-04 15:35:49 +02:00
Stefan Weil
c8b5a29ce9
Remove unneeded type casts
...
This removes unneded type casts to (char*) and (const char*).
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-04 14:23:55 +02:00
Amit D
62c7b796da
Merge branch 'master' into disable-legacy
2018-07-04 11:14:33 +03:00
amitdo
15fb491be4
Add missing #ifdef in tesseractmain.cpp
2018-07-04 09:57:12 +03:00
amitdo
134779f758
Fix duplicate #ifndef in blobclass.cpp
2018-07-04 08:49:58 +03:00
amitdo
aa9f4b4861
Add an option to compile tesseract without the code of the legacy OCR engine
2018-07-03 18:49:42 +03:00
Stefan Weil
6d170a15ec
Replace tabs by blanks in source code
...
blobs.cpp had many tabs and was formatted with clang-format.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-03 16:29:14 +02:00
Stefan Weil
626a229cac
Remove nwmain.h
...
The macro DECLARE_MAIN is not used by the current Tesseract code.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-03 15:54:41 +02:00
Stefan Weil
f8684cb0fd
Fix syntax error (regression)
...
It was introduced in commit bb7bb1f0b8
.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-03 15:53:42 +02:00
zdenop
4b26b8d9a9
Merge pull request #1735 from stweil/pdblock
...
Remove blckerr.h
2018-07-03 15:24:09 +02:00
Stefan Weil
bb7bb1f0b8
Remove old comments for exceptions
...
Exceptions are no longer used.
Remove also some history comments and fix several comments.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-03 14:53:00 +02:00
Stefan Weil
889f7eaa1b
Remove blckerr.h
...
Move the two ERRCODE constants which are still in use to pdblock.cpp.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-03 14:08:57 +02:00
Stefan Weil
872813245d
Replace function DoError and remove danerror.cpp, danerror.h
...
This allows also removing all error trap macros.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-03 13:21:17 +02:00
Stefan Weil
6a553f9f28
Clean up cutil.h
...
* Remove unrelated include statements from cutil.h.
* Remove macros FALSE, TRUE.
* Move macro CHARS_PER_LINE from cutil.h to dict.h.
* Remove unneeded macro _ARGS.
* Remove unused typedef statements.
* Remove macro new_line (only used once).
* Remove unused macro print_string.
* Update include statements for other source files.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-03 11:31:41 +02:00
zdenop
a0ed0b4987
Merge pull request #1732 from stweil/headerfiles
...
Remove unused include files
2018-07-03 07:57:15 +02:00
zdenop
66ea6c4470
Merge pull request #1730 from stweil/pi
...
Remove unneeded macro definition for M_PI
2018-07-03 07:26:59 +02:00
Stefan Weil
9325fbe322
Remove unused include files
...
ccstruct/hpdsizes.h was not used at all.
cutil/const.h was included, but not needed.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-03 07:25:38 +02:00
Stefan Weil
2cd2d3200f
Remove functions open_file, exists_file
...
cutil.cpp is now no longer needed and removed, too.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-03 06:45:34 +02:00
Stefan Weil
cbd7b15788
Remove unneeded macro definition for M_PI
...
There is already one in platform.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-02 21:59:16 +02:00
Stefan Weil
f7b61891bc
Replace macro PI by macro M_PI
...
One definition for pi is sufficient.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-02 21:26:53 +02:00
zdenop
c323312c17
Merge pull request #1725 from stweil/doerror
...
Replace Efopen by fopen and remove efio.cpp, efio.h
2018-07-02 20:53:28 +02:00
Stefan Weil
3840a769d6
Remove unused function long_rand
...
Remove also some old comments.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-02 20:11:42 +02:00
Stefan Weil
b57afc7c78
Replace Efopen by fopen and remove efio.cpp, efio.h
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-02 17:46:28 +02:00
Stefan Weil
faae87beaa
Replace FLOAT32 by float data type
...
On most systems float is the IEEE 754 single-precision binary
floating-point format (32 bits). Tesseract does not support other systems.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-02 13:29:39 +02:00
Stefan Weil
f6c3c8cf4d
Replace MAX_FLOAT32 by standard FLT_MAX and remove unused MIN_FLOAT32
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-02 13:29:39 +02:00
Stefan Weil
919901eb19
Replace FLOAT64 by double data type
...
On most systems double is the IEEE 754 double-precision binary
floating-point format (64 bits). Tesseract does not support other systems.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-02 08:07:37 +02:00
Stefan Weil
abbd78a053
Fix CID 1340271, 1340272, 1340273, 1340274 (Use after free)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 20:18:39 +02:00
Stefan Weil
52b44c5ebf
Fix CID 1164530 (Logically dead code)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 20:01:56 +02:00
Stefan Weil
57970443b4
Fix CID 1393661 (Arguments in wrong order)
...
It did not cause a problem as both arguments were 0.
Update also the function prototype of HistogramRectOCL to
accept a void pointer which allows removing a type cast.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 19:40:44 +02:00
Stefan Weil
09da044a77
Fix CID 1164553 (Division or modulo by float zero)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 19:27:01 +02:00
Stefan Weil
1b303e5d37
Fix CID 1393662 Resource leak
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 19:27:01 +02:00
Stefan Weil
d3c4642d8f
Fix CID 1393662 (Resource leak)
2018-07-01 19:27:01 +02:00
Stefan Weil
98758fb300
opencl: Use std::vector and clean code
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 19:27:01 +02:00
Stefan Weil
53795a88b5
Fix CID 1158180 Argument cannot be negative
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 19:18:32 +02:00
Stefan Weil
6801085376
pdfrenderer: Fix ClipBaseline and optimize code
...
The division was made with integers, giving a wrong result.
* Avoid division and use pure integer operations.
* Add missing "static" attribute.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 08:33:56 +02:00
Stefan Weil
e8e94d372c
Fix CID 1340287 (Unchecked return value)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 07:54:11 +02:00
Stefan Weil
a49b8f1d21
Fix CID 1297960 (Dereference after null check)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 07:54:11 +02:00
Stefan Weil
86eb4dfcdc
Fix CID 1164646 (Uninitialized pointer field)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-07-01 07:54:11 +02:00
Stefan Weil
de072cc01e
Format OpenCL code
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 18:32:53 +02:00
Stefan Weil
740a821c76
Fix CID 1393673 (Ignoring number of bytes read)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:25:09 +02:00
Stefan Weil
075dc984e9
Fix CID 1393671 (Uninitialized scalar variable)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:10:25 +02:00
Stefan Weil
8f33d10bfb
Fix CID 1393670 (Resource leak)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:10:16 +02:00
Stefan Weil
12a601fffa
Fix CID 1393669 (Resource leak)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:21 +02:00
Stefan Weil
1de55c8604
Fix CID 1393668 (Uninitialized scalar variable)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:21 +02:00
Stefan Weil
1e1f35cd5c
Fix CID 1393667 (Copy into fixed size buffer)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:21 +02:00
Stefan Weil
85794ca188
Fix CID 1393666 (Big parameter passed by value)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:21 +02:00
Stefan Weil
3d2f73503e
Fix CID 1393665 (Uninitialized scalar variable)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:21 +02:00
Stefan Weil
a95917a6a4
Fix CID 1393664 (Uninitialized scalar variable)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:21 +02:00
Stefan Weil
c9737c7f93
Fix CID 1393663 (Big parameter passed by value)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:20 +02:00
Stefan Weil
53596f7837
Fix CID 1393662 (Resource leak)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 15:07:19 +02:00
Stefan Weil
fcff2f2ce2
Fix CID 1242849 (Unused value)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 11:46:19 +02:00
Stefan Weil
eabd10d8f2
Fix CID 1158180 (Argument cannot be negative) and clean code a bit
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 11:41:41 +02:00
Stefan Weil
4cc103cd42
Fix CID 1157757 (Logically dead code)
...
deviceNameStart cannot be NULL here.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-30 10:36:45 +02:00
Stefan Weil
36c985b715
Fix CID 1164746 (Big parameter passed by value)
...
Use std::vector instead of GenericVector.
Fix also several signed / unsigned compiler warnings.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-29 22:24:00 +02:00
Stefan Weil
20cd6d2328
dotproductsse: Fix include statements
...
The changes are based on an analysis done with include-what-you-use.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-25 19:15:37 +02:00
Stefan Weil
9bb5a87760
Remove stderr.h and its include statements
...
MEMORY_OUT is no longer used.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-25 16:14:20 +02:00
Stefan Weil
db7f2009d9
Remove memry.cpp, memry.h
...
The proprietary memory allocators alloc_string, alloc_mem
are no longer used.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-25 16:13:59 +02:00
Stefan Weil
cda04b1d6d
tordmain: Replace alloc_mem, free_mem by C++ std::vector
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-25 16:13:59 +02:00
Stefan Weil
3032b65b48
pithsync: Replace alloc_mem, free_mem by C++ std::vector
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-25 16:13:59 +02:00