node-native-win-utils 1.4.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -82
- package/binding.gyp +2 -0
- package/dist/dirnameLocal.cjs +4 -0
- package/dist/dirnameLocal.d.cts +1 -0
- package/dist/dirnameLocal.d.mts +1 -0
- package/dist/dirnameLocal.mjs +2 -0
- package/dist/{index.js → index.cjs} +83 -16
- package/dist/{index.d.ts → index.d.cts} +68 -17
- package/dist/index.d.mts +230 -0
- package/dist/index.mjs +212 -0
- package/dist/keyCodes.d.mts +101 -0
- package/dist/keyCodes.mjs +201 -0
- package/node22.json +16 -0
- package/package.json +19 -9
- package/prebuilds/win32-x64/node-native-win-utils.node +0 -0
- package/src/cpp/keyboard.cpp +141 -140
- package/src/cpp/main.cpp +9 -3
- package/src/cpp/{capturewindow.cpp → screenshot.cpp} +174 -2
- package/src/dirnameLocal.mts +3 -0
- package/src/index.mts +455 -0
- package/src/keyCodes.mts +203 -0
- package/dllCopy.js +0 -14
- package/include/opencv2/core/affine.hpp +0 -678
- package/include/opencv2/core/async.hpp +0 -105
- package/include/opencv2/core/base.hpp +0 -664
- package/include/opencv2/core/bindings_utils.hpp +0 -325
- package/include/opencv2/core/bufferpool.hpp +0 -40
- package/include/opencv2/core/check.hpp +0 -170
- package/include/opencv2/core/core.hpp +0 -48
- package/include/opencv2/core/core_c.h +0 -3128
- package/include/opencv2/core/cuda/block.hpp +0 -211
- package/include/opencv2/core/cuda/border_interpolate.hpp +0 -722
- package/include/opencv2/core/cuda/color.hpp +0 -309
- package/include/opencv2/core/cuda/common.hpp +0 -131
- package/include/opencv2/core/cuda/datamov_utils.hpp +0 -113
- package/include/opencv2/core/cuda/detail/color_detail.hpp +0 -2018
- package/include/opencv2/core/cuda/detail/reduce.hpp +0 -365
- package/include/opencv2/core/cuda/detail/reduce_key_val.hpp +0 -502
- package/include/opencv2/core/cuda/detail/transform_detail.hpp +0 -392
- package/include/opencv2/core/cuda/detail/type_traits_detail.hpp +0 -191
- package/include/opencv2/core/cuda/detail/vec_distance_detail.hpp +0 -121
- package/include/opencv2/core/cuda/dynamic_smem.hpp +0 -88
- package/include/opencv2/core/cuda/emulation.hpp +0 -269
- package/include/opencv2/core/cuda/filters.hpp +0 -293
- package/include/opencv2/core/cuda/funcattrib.hpp +0 -79
- package/include/opencv2/core/cuda/functional.hpp +0 -805
- package/include/opencv2/core/cuda/limits.hpp +0 -128
- package/include/opencv2/core/cuda/reduce.hpp +0 -209
- package/include/opencv2/core/cuda/saturate_cast.hpp +0 -292
- package/include/opencv2/core/cuda/scan.hpp +0 -258
- package/include/opencv2/core/cuda/simd_functions.hpp +0 -869
- package/include/opencv2/core/cuda/transform.hpp +0 -75
- package/include/opencv2/core/cuda/type_traits.hpp +0 -90
- package/include/opencv2/core/cuda/utility.hpp +0 -230
- package/include/opencv2/core/cuda/vec_distance.hpp +0 -232
- package/include/opencv2/core/cuda/vec_math.hpp +0 -923
- package/include/opencv2/core/cuda/vec_traits.hpp +0 -288
- package/include/opencv2/core/cuda/warp.hpp +0 -139
- package/include/opencv2/core/cuda/warp_reduce.hpp +0 -76
- package/include/opencv2/core/cuda/warp_shuffle.hpp +0 -162
- package/include/opencv2/core/cuda.hpp +0 -1279
- package/include/opencv2/core/cuda.inl.hpp +0 -763
- package/include/opencv2/core/cuda_stream_accessor.hpp +0 -86
- package/include/opencv2/core/cuda_types.hpp +0 -144
- package/include/opencv2/core/cv_cpu_dispatch.h +0 -381
- package/include/opencv2/core/cv_cpu_helper.h +0 -550
- package/include/opencv2/core/cvdef.h +0 -973
- package/include/opencv2/core/cvstd.hpp +0 -190
- package/include/opencv2/core/cvstd.inl.hpp +0 -197
- package/include/opencv2/core/cvstd_wrapper.hpp +0 -154
- package/include/opencv2/core/detail/async_promise.hpp +0 -71
- package/include/opencv2/core/detail/dispatch_helper.impl.hpp +0 -49
- package/include/opencv2/core/detail/exception_ptr.hpp +0 -27
- package/include/opencv2/core/directx.hpp +0 -184
- package/include/opencv2/core/dualquaternion.hpp +0 -979
- package/include/opencv2/core/dualquaternion.inl.hpp +0 -487
- package/include/opencv2/core/eigen.hpp +0 -402
- package/include/opencv2/core/fast_math.hpp +0 -433
- package/include/opencv2/core/hal/hal.hpp +0 -256
- package/include/opencv2/core/hal/interface.h +0 -190
- package/include/opencv2/core/hal/intrin.hpp +0 -939
- package/include/opencv2/core/hal/intrin_avx.hpp +0 -3177
- package/include/opencv2/core/hal/intrin_avx512.hpp +0 -3090
- package/include/opencv2/core/hal/intrin_cpp.hpp +0 -3321
- package/include/opencv2/core/hal/intrin_forward.hpp +0 -191
- package/include/opencv2/core/hal/intrin_lasx.hpp +0 -3236
- package/include/opencv2/core/hal/intrin_msa.hpp +0 -1887
- package/include/opencv2/core/hal/intrin_neon.hpp +0 -2610
- package/include/opencv2/core/hal/intrin_rvv.hpp +0 -3320
- package/include/opencv2/core/hal/intrin_rvv071.hpp +0 -2545
- package/include/opencv2/core/hal/intrin_rvv_scalable.hpp +0 -2080
- package/include/opencv2/core/hal/intrin_sse.hpp +0 -3467
- package/include/opencv2/core/hal/intrin_sse_em.hpp +0 -180
- package/include/opencv2/core/hal/intrin_vsx.hpp +0 -1608
- package/include/opencv2/core/hal/intrin_wasm.hpp +0 -2782
- package/include/opencv2/core/hal/msa_macros.h +0 -1558
- package/include/opencv2/core/hal/simd_utils.impl.hpp +0 -186
- package/include/opencv2/core/llapi/llapi.h +0 -102
- package/include/opencv2/core/mat.hpp +0 -3775
- package/include/opencv2/core/mat.inl.hpp +0 -3422
- package/include/opencv2/core/matx.hpp +0 -1536
- package/include/opencv2/core/neon_utils.hpp +0 -128
- package/include/opencv2/core/ocl.hpp +0 -917
- package/include/opencv2/core/ocl_genbase.hpp +0 -69
- package/include/opencv2/core/opencl/ocl_defs.hpp +0 -82
- package/include/opencv2/core/opencl/opencl_info.hpp +0 -212
- package/include/opencv2/core/opencl/opencl_svm.hpp +0 -81
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clblas.hpp +0 -602
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_clfft.hpp +0 -146
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp +0 -371
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_core_wrappers.hpp +0 -272
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp +0 -62
- package/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp +0 -42
- package/include/opencv2/core/opencl/runtime/opencl_clblas.hpp +0 -53
- package/include/opencv2/core/opencl/runtime/opencl_clfft.hpp +0 -53
- package/include/opencv2/core/opencl/runtime/opencl_core.hpp +0 -84
- package/include/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp +0 -47
- package/include/opencv2/core/opencl/runtime/opencl_gl.hpp +0 -53
- package/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp +0 -47
- package/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp +0 -48
- package/include/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp +0 -42
- package/include/opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp +0 -166
- package/include/opencv2/core/opengl.hpp +0 -733
- package/include/opencv2/core/openvx/ovx_defs.hpp +0 -48
- package/include/opencv2/core/operations.hpp +0 -610
- package/include/opencv2/core/optim.hpp +0 -302
- package/include/opencv2/core/ovx.hpp +0 -28
- package/include/opencv2/core/parallel/backend/parallel_for.openmp.hpp +0 -72
- package/include/opencv2/core/parallel/backend/parallel_for.tbb.hpp +0 -153
- package/include/opencv2/core/parallel/parallel_backend.hpp +0 -90
- package/include/opencv2/core/persistence.hpp +0 -1350
- package/include/opencv2/core/private/cv_cpu_include_simd_declarations.hpp +0 -30
- package/include/opencv2/core/private.cuda.hpp +0 -169
- package/include/opencv2/core/private.hpp +0 -896
- package/include/opencv2/core/quaternion.hpp +0 -1696
- package/include/opencv2/core/quaternion.inl.hpp +0 -1063
- package/include/opencv2/core/saturate.hpp +0 -180
- package/include/opencv2/core/simd_intrinsics.hpp +0 -87
- package/include/opencv2/core/softfloat.hpp +0 -514
- package/include/opencv2/core/sse_utils.hpp +0 -652
- package/include/opencv2/core/traits.hpp +0 -417
- package/include/opencv2/core/types.hpp +0 -2457
- package/include/opencv2/core/types_c.h +0 -2126
- package/include/opencv2/core/utility.hpp +0 -1229
- package/include/opencv2/core/utils/allocator_stats.hpp +0 -29
- package/include/opencv2/core/utils/allocator_stats.impl.hpp +0 -158
- package/include/opencv2/core/utils/buffer_area.private.hpp +0 -136
- package/include/opencv2/core/utils/configuration.private.hpp +0 -22
- package/include/opencv2/core/utils/filesystem.hpp +0 -82
- package/include/opencv2/core/utils/filesystem.private.hpp +0 -66
- package/include/opencv2/core/utils/fp_control.private.hpp +0 -29
- package/include/opencv2/core/utils/fp_control_utils.hpp +0 -69
- package/include/opencv2/core/utils/instrumentation.hpp +0 -125
- package/include/opencv2/core/utils/lock.private.hpp +0 -119
- package/include/opencv2/core/utils/logger.defines.hpp +0 -42
- package/include/opencv2/core/utils/logger.hpp +0 -218
- package/include/opencv2/core/utils/logtag.hpp +0 -28
- package/include/opencv2/core/utils/plugin_loader.private.hpp +0 -165
- package/include/opencv2/core/utils/tls.hpp +0 -235
- package/include/opencv2/core/utils/trace.hpp +0 -252
- package/include/opencv2/core/utils/trace.private.hpp +0 -421
- package/include/opencv2/core/va_intel.hpp +0 -75
- package/include/opencv2/core/version.hpp +0 -26
- package/include/opencv2/core/vsx_utils.hpp +0 -1047
- package/include/opencv2/core.hpp +0 -3365
- package/include/opencv2/imgcodecs/imgcodecs.hpp +0 -48
- package/include/opencv2/imgcodecs/imgcodecs_c.h +0 -1
- package/include/opencv2/imgcodecs/ios.h +0 -59
- package/include/opencv2/imgcodecs/legacy/constants_c.h +0 -54
- package/include/opencv2/imgcodecs/macosx.h +0 -20
- package/include/opencv2/imgcodecs.hpp +0 -407
- package/include/opencv2/imgproc/bindings.hpp +0 -34
- package/include/opencv2/imgproc/detail/gcgraph.hpp +0 -395
- package/include/opencv2/imgproc/hal/hal.hpp +0 -246
- package/include/opencv2/imgproc/hal/interface.h +0 -46
- package/include/opencv2/imgproc/imgproc.hpp +0 -48
- package/include/opencv2/imgproc/imgproc_c.h +0 -1177
- package/include/opencv2/imgproc/segmentation.hpp +0 -141
- package/include/opencv2/imgproc/types_c.h +0 -659
- package/include/opencv2/imgproc.hpp +0 -5035
- package/include/opencv2/opencv_modules.hpp +0 -17
- package/include/tesseract/baseapi.h +0 -820
- package/include/tesseract/capi.h +0 -485
- package/include/tesseract/export.h +0 -37
- package/include/tesseract/ltrresultiterator.h +0 -235
- package/include/tesseract/ocrclass.h +0 -158
- package/include/tesseract/osdetect.h +0 -139
- package/include/tesseract/pageiterator.h +0 -364
- package/include/tesseract/publictypes.h +0 -281
- package/include/tesseract/renderer.h +0 -334
- package/include/tesseract/resultiterator.h +0 -250
- package/include/tesseract/tesseract.h +0 -40
- package/include/tesseract/unichar.h +0 -174
- package/include/tesseract/version.h +0 -34
- package/include/tesseract/version.h.in +0 -34
- package/libs/libjpeg-turbo.lib +0 -0
- package/libs/libpng.lib +0 -0
- package/libs/opencv_core470.lib +0 -0
- package/libs/opencv_imgcodecs470.lib +0 -0
- package/libs/opencv_imgproc470.lib +0 -0
- package/libs/tesseract.lib +0 -0
- package/libs/zlib.lib +0 -0
- /package/dist/{keyCodes.js → keyCodes.cjs} +0 -0
- /package/dist/{keyCodes.d.ts → keyCodes.d.cts} +0 -0
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// File: pageiterator.h
|
|
3
|
-
// Description: Iterator for tesseract page structure that avoids using
|
|
4
|
-
// tesseract internal data structures.
|
|
5
|
-
// Author: Ray Smith
|
|
6
|
-
//
|
|
7
|
-
// (C) Copyright 2010, Google Inc.
|
|
8
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
// you may not use this file except in compliance with the License.
|
|
10
|
-
// You may obtain a copy of the License at
|
|
11
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
// See the License for the specific language governing permissions and
|
|
16
|
-
// limitations under the License.
|
|
17
|
-
|
|
18
|
-
#ifndef TESSERACT_CCMAIN_PAGEITERATOR_H_
|
|
19
|
-
#define TESSERACT_CCMAIN_PAGEITERATOR_H_
|
|
20
|
-
|
|
21
|
-
#include "export.h"
|
|
22
|
-
#include "publictypes.h"
|
|
23
|
-
|
|
24
|
-
struct Pix;
|
|
25
|
-
struct Pta;
|
|
26
|
-
|
|
27
|
-
namespace tesseract {
|
|
28
|
-
|
|
29
|
-
struct BlamerBundle;
|
|
30
|
-
class C_BLOB_IT;
|
|
31
|
-
class PAGE_RES;
|
|
32
|
-
class PAGE_RES_IT;
|
|
33
|
-
class WERD;
|
|
34
|
-
|
|
35
|
-
class Tesseract;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Class to iterate over tesseract page structure, providing access to all
|
|
39
|
-
* levels of the page hierarchy, without including any tesseract headers or
|
|
40
|
-
* having to handle any tesseract structures.
|
|
41
|
-
* WARNING! This class points to data held within the TessBaseAPI class, and
|
|
42
|
-
* therefore can only be used while the TessBaseAPI class still exists and
|
|
43
|
-
* has not been subjected to a call of Init, SetImage, Recognize, Clear, End
|
|
44
|
-
* DetectOS, or anything else that changes the internal PAGE_RES.
|
|
45
|
-
* See tesseract/publictypes.h for the definition of PageIteratorLevel.
|
|
46
|
-
* See also ResultIterator, derived from PageIterator, which adds in the
|
|
47
|
-
* ability to access OCR output with text-specific methods.
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
class TESS_API PageIterator {
|
|
51
|
-
public:
|
|
52
|
-
/**
|
|
53
|
-
* page_res and tesseract come directly from the BaseAPI.
|
|
54
|
-
* The rectangle parameters are copied indirectly from the Thresholder,
|
|
55
|
-
* via the BaseAPI. They represent the coordinates of some rectangle in an
|
|
56
|
-
* original image (in top-left-origin coordinates) and therefore the top-left
|
|
57
|
-
* needs to be added to any output boxes in order to specify coordinates
|
|
58
|
-
* in the original image. See TessBaseAPI::SetRectangle.
|
|
59
|
-
* The scale and scaled_yres are in case the Thresholder scaled the image
|
|
60
|
-
* rectangle prior to thresholding. Any coordinates in tesseract's image
|
|
61
|
-
* must be divided by scale before adding (rect_left, rect_top).
|
|
62
|
-
* The scaled_yres indicates the effective resolution of the binary image
|
|
63
|
-
* that tesseract has been given by the Thresholder.
|
|
64
|
-
* After the constructor, Begin has already been called.
|
|
65
|
-
*/
|
|
66
|
-
PageIterator(PAGE_RES *page_res, Tesseract *tesseract, int scale,
|
|
67
|
-
int scaled_yres, int rect_left, int rect_top, int rect_width,
|
|
68
|
-
int rect_height);
|
|
69
|
-
virtual ~PageIterator();
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Page/ResultIterators may be copied! This makes it possible to iterate over
|
|
73
|
-
* all the objects at a lower level, while maintaining an iterator to
|
|
74
|
-
* objects at a higher level. These constructors DO NOT CALL Begin, so
|
|
75
|
-
* iterations will continue from the location of src.
|
|
76
|
-
*/
|
|
77
|
-
PageIterator(const PageIterator &src);
|
|
78
|
-
const PageIterator &operator=(const PageIterator &src);
|
|
79
|
-
|
|
80
|
-
/** Are we positioned at the same location as other? */
|
|
81
|
-
bool PositionedAtSameWord(const PAGE_RES_IT *other) const;
|
|
82
|
-
|
|
83
|
-
// ============= Moving around within the page ============.
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Moves the iterator to point to the start of the page to begin an
|
|
87
|
-
* iteration.
|
|
88
|
-
*/
|
|
89
|
-
virtual void Begin();
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Moves the iterator to the beginning of the paragraph.
|
|
93
|
-
* This class implements this functionality by moving it to the zero indexed
|
|
94
|
-
* blob of the first (leftmost) word on the first row of the paragraph.
|
|
95
|
-
*/
|
|
96
|
-
virtual void RestartParagraph();
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Return whether this iterator points anywhere in the first textline of a
|
|
100
|
-
* paragraph.
|
|
101
|
-
*/
|
|
102
|
-
bool IsWithinFirstTextlineOfParagraph() const;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Moves the iterator to the beginning of the text line.
|
|
106
|
-
* This class implements this functionality by moving it to the zero indexed
|
|
107
|
-
* blob of the first (leftmost) word of the row.
|
|
108
|
-
*/
|
|
109
|
-
virtual void RestartRow();
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Moves to the start of the next object at the given level in the
|
|
113
|
-
* page hierarchy, and returns false if the end of the page was reached.
|
|
114
|
-
* NOTE that RIL_SYMBOL will skip non-text blocks, but all other
|
|
115
|
-
* PageIteratorLevel level values will visit each non-text block once.
|
|
116
|
-
* Think of non text blocks as containing a single para, with a single line,
|
|
117
|
-
* with a single imaginary word.
|
|
118
|
-
* Calls to Next with different levels may be freely intermixed.
|
|
119
|
-
* This function iterates words in right-to-left scripts correctly, if
|
|
120
|
-
* the appropriate language has been loaded into Tesseract.
|
|
121
|
-
*/
|
|
122
|
-
virtual bool Next(PageIteratorLevel level);
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Returns true if the iterator is at the start of an object at the given
|
|
126
|
-
* level.
|
|
127
|
-
*
|
|
128
|
-
* For instance, suppose an iterator it is pointed to the first symbol of the
|
|
129
|
-
* first word of the third line of the second paragraph of the first block in
|
|
130
|
-
* a page, then:
|
|
131
|
-
* it.IsAtBeginningOf(RIL_BLOCK) = false
|
|
132
|
-
* it.IsAtBeginningOf(RIL_PARA) = false
|
|
133
|
-
* it.IsAtBeginningOf(RIL_TEXTLINE) = true
|
|
134
|
-
* it.IsAtBeginningOf(RIL_WORD) = true
|
|
135
|
-
* it.IsAtBeginningOf(RIL_SYMBOL) = true
|
|
136
|
-
*/
|
|
137
|
-
virtual bool IsAtBeginningOf(PageIteratorLevel level) const;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Returns whether the iterator is positioned at the last element in a
|
|
141
|
-
* given level. (e.g. the last word in a line, the last line in a block)
|
|
142
|
-
*
|
|
143
|
-
* Here's some two-paragraph example
|
|
144
|
-
* text. It starts off innocuously
|
|
145
|
-
* enough but quickly turns bizarre.
|
|
146
|
-
* The author inserts a cornucopia
|
|
147
|
-
* of words to guard against confused
|
|
148
|
-
* references.
|
|
149
|
-
*
|
|
150
|
-
* Now take an iterator it pointed to the start of "bizarre."
|
|
151
|
-
* it.IsAtFinalElement(RIL_PARA, RIL_SYMBOL) = false
|
|
152
|
-
* it.IsAtFinalElement(RIL_PARA, RIL_WORD) = true
|
|
153
|
-
* it.IsAtFinalElement(RIL_BLOCK, RIL_WORD) = false
|
|
154
|
-
*/
|
|
155
|
-
virtual bool IsAtFinalElement(PageIteratorLevel level,
|
|
156
|
-
PageIteratorLevel element) const;
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Returns whether this iterator is positioned
|
|
160
|
-
* before other: -1
|
|
161
|
-
* equal to other: 0
|
|
162
|
-
* after other: 1
|
|
163
|
-
*/
|
|
164
|
-
int Cmp(const PageIterator &other) const;
|
|
165
|
-
|
|
166
|
-
// ============= Accessing data ==============.
|
|
167
|
-
// Coordinate system:
|
|
168
|
-
// Integer coordinates are at the cracks between the pixels.
|
|
169
|
-
// The top-left corner of the top-left pixel in the image is at (0,0).
|
|
170
|
-
// The bottom-right corner of the bottom-right pixel in the image is at
|
|
171
|
-
// (width, height).
|
|
172
|
-
// Every bounding box goes from the top-left of the top-left contained
|
|
173
|
-
// pixel to the bottom-right of the bottom-right contained pixel, so
|
|
174
|
-
// the bounding box of the single top-left pixel in the image is:
|
|
175
|
-
// (0,0)->(1,1).
|
|
176
|
-
// If an image rectangle has been set in the API, then returned coordinates
|
|
177
|
-
// relate to the original (full) image, rather than the rectangle.
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Controls what to include in a bounding box. Bounding boxes of all levels
|
|
181
|
-
* between RIL_WORD and RIL_BLOCK can include or exclude potential diacritics.
|
|
182
|
-
* Between layout analysis and recognition, it isn't known where all
|
|
183
|
-
* diacritics belong, so this control is used to include or exclude some
|
|
184
|
-
* diacritics that are above or below the main body of the word. In most cases
|
|
185
|
-
* where the placement is obvious, and after recognition, it doesn't make as
|
|
186
|
-
* much difference, as the diacritics will already be included in the word.
|
|
187
|
-
*/
|
|
188
|
-
void SetBoundingBoxComponents(bool include_upper_dots,
|
|
189
|
-
bool include_lower_dots) {
|
|
190
|
-
include_upper_dots_ = include_upper_dots;
|
|
191
|
-
include_lower_dots_ = include_lower_dots;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Returns the bounding rectangle of the current object at the given level.
|
|
196
|
-
* See comment on coordinate system above.
|
|
197
|
-
* Returns false if there is no such object at the current position.
|
|
198
|
-
* The returned bounding box is guaranteed to match the size and position
|
|
199
|
-
* of the image returned by GetBinaryImage, but may clip foreground pixels
|
|
200
|
-
* from a grey image. The padding argument to GetImage can be used to expand
|
|
201
|
-
* the image to include more foreground pixels. See GetImage below.
|
|
202
|
-
*/
|
|
203
|
-
bool BoundingBox(PageIteratorLevel level, int *left, int *top, int *right,
|
|
204
|
-
int *bottom) const;
|
|
205
|
-
bool BoundingBox(PageIteratorLevel level, int padding, int *left, int *top,
|
|
206
|
-
int *right, int *bottom) const;
|
|
207
|
-
/**
|
|
208
|
-
* Returns the bounding rectangle of the object in a coordinate system of the
|
|
209
|
-
* working image rectangle having its origin at (rect_left_, rect_top_) with
|
|
210
|
-
* respect to the original image and is scaled by a factor scale_.
|
|
211
|
-
*/
|
|
212
|
-
bool BoundingBoxInternal(PageIteratorLevel level, int *left, int *top,
|
|
213
|
-
int *right, int *bottom) const;
|
|
214
|
-
|
|
215
|
-
/** Returns whether there is no object of a given level. */
|
|
216
|
-
bool Empty(PageIteratorLevel level) const;
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Returns the type of the current block.
|
|
220
|
-
* See tesseract/publictypes.h for PolyBlockType.
|
|
221
|
-
*/
|
|
222
|
-
PolyBlockType BlockType() const;
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Returns the polygon outline of the current block. The returned Pta must
|
|
226
|
-
* be ptaDestroy-ed after use. Note that the returned Pta lists the vertices
|
|
227
|
-
* of the polygon, and the last edge is the line segment between the last
|
|
228
|
-
* point and the first point. nullptr will be returned if the iterator is
|
|
229
|
-
* at the end of the document or layout analysis was not used.
|
|
230
|
-
*/
|
|
231
|
-
Pta *BlockPolygon() const;
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Returns a binary image of the current object at the given level.
|
|
235
|
-
* The position and size match the return from BoundingBoxInternal, and so
|
|
236
|
-
* this could be upscaled with respect to the original input image.
|
|
237
|
-
* Use pixDestroy to delete the image after use.
|
|
238
|
-
*/
|
|
239
|
-
Pix *GetBinaryImage(PageIteratorLevel level) const;
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Returns an image of the current object at the given level in greyscale
|
|
243
|
-
* if available in the input. To guarantee a binary image use BinaryImage.
|
|
244
|
-
* NOTE that in order to give the best possible image, the bounds are
|
|
245
|
-
* expanded slightly over the binary connected component, by the supplied
|
|
246
|
-
* padding, so the top-left position of the returned image is returned
|
|
247
|
-
* in (left,top). These will most likely not match the coordinates
|
|
248
|
-
* returned by BoundingBox.
|
|
249
|
-
* If you do not supply an original image, you will get a binary one.
|
|
250
|
-
* Use pixDestroy to delete the image after use.
|
|
251
|
-
*/
|
|
252
|
-
Pix *GetImage(PageIteratorLevel level, int padding, Pix *original_img,
|
|
253
|
-
int *left, int *top) const;
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Returns the baseline of the current object at the given level.
|
|
257
|
-
* The baseline is the line that passes through (x1, y1) and (x2, y2).
|
|
258
|
-
* WARNING: with vertical text, baselines may be vertical!
|
|
259
|
-
* Returns false if there is no baseline at the current position.
|
|
260
|
-
*/
|
|
261
|
-
bool Baseline(PageIteratorLevel level, int *x1, int *y1, int *x2,
|
|
262
|
-
int *y2) const;
|
|
263
|
-
|
|
264
|
-
// Returns the attributes of the current row.
|
|
265
|
-
void RowAttributes(float *row_height, float *descenders,
|
|
266
|
-
float *ascenders) const;
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Returns orientation for the block the iterator points to.
|
|
270
|
-
* orientation, writing_direction, textline_order: see publictypes.h
|
|
271
|
-
* deskew_angle: after rotating the block so the text orientation is
|
|
272
|
-
* upright, how many radians does one have to rotate the
|
|
273
|
-
* block anti-clockwise for it to be level?
|
|
274
|
-
* -Pi/4 <= deskew_angle <= Pi/4
|
|
275
|
-
*/
|
|
276
|
-
void Orientation(tesseract::Orientation *orientation,
|
|
277
|
-
tesseract::WritingDirection *writing_direction,
|
|
278
|
-
tesseract::TextlineOrder *textline_order,
|
|
279
|
-
float *deskew_angle) const;
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Returns information about the current paragraph, if available.
|
|
283
|
-
*
|
|
284
|
-
* justification -
|
|
285
|
-
* LEFT if ragged right, or fully justified and script is left-to-right.
|
|
286
|
-
* RIGHT if ragged left, or fully justified and script is right-to-left.
|
|
287
|
-
* unknown if it looks like source code or we have very few lines.
|
|
288
|
-
* is_list_item -
|
|
289
|
-
* true if we believe this is a member of an ordered or unordered list.
|
|
290
|
-
* is_crown -
|
|
291
|
-
* true if the first line of the paragraph is aligned with the other
|
|
292
|
-
* lines of the paragraph even though subsequent paragraphs have first
|
|
293
|
-
* line indents. This typically indicates that this is the continuation
|
|
294
|
-
* of a previous paragraph or that it is the very first paragraph in
|
|
295
|
-
* the chapter.
|
|
296
|
-
* first_line_indent -
|
|
297
|
-
* For LEFT aligned paragraphs, the first text line of paragraphs of
|
|
298
|
-
* this kind are indented this many pixels from the left edge of the
|
|
299
|
-
* rest of the paragraph.
|
|
300
|
-
* for RIGHT aligned paragraphs, the first text line of paragraphs of
|
|
301
|
-
* this kind are indented this many pixels from the right edge of the
|
|
302
|
-
* rest of the paragraph.
|
|
303
|
-
* NOTE 1: This value may be negative.
|
|
304
|
-
* NOTE 2: if *is_crown == true, the first line of this paragraph is
|
|
305
|
-
* actually flush, and first_line_indent is set to the "common"
|
|
306
|
-
* first_line_indent for subsequent paragraphs in this block
|
|
307
|
-
* of text.
|
|
308
|
-
*/
|
|
309
|
-
void ParagraphInfo(tesseract::ParagraphJustification *justification,
|
|
310
|
-
bool *is_list_item, bool *is_crown,
|
|
311
|
-
int *first_line_indent) const;
|
|
312
|
-
|
|
313
|
-
// If the current WERD_RES (it_->word()) is not nullptr, sets the BlamerBundle
|
|
314
|
-
// of the current word to the given pointer (takes ownership of the pointer)
|
|
315
|
-
// and returns true.
|
|
316
|
-
// Can only be used when iterating on the word level.
|
|
317
|
-
bool SetWordBlamerBundle(BlamerBundle *blamer_bundle);
|
|
318
|
-
|
|
319
|
-
protected:
|
|
320
|
-
/**
|
|
321
|
-
* Sets up the internal data for iterating the blobs of a new word, then
|
|
322
|
-
* moves the iterator to the given offset.
|
|
323
|
-
*/
|
|
324
|
-
void BeginWord(int offset);
|
|
325
|
-
|
|
326
|
-
/** Pointer to the page_res owned by the API. */
|
|
327
|
-
PAGE_RES *page_res_;
|
|
328
|
-
/** Pointer to the Tesseract object owned by the API. */
|
|
329
|
-
Tesseract *tesseract_;
|
|
330
|
-
/**
|
|
331
|
-
* The iterator to the page_res_. Owned by this ResultIterator.
|
|
332
|
-
* A pointer just to avoid dragging in Tesseract includes.
|
|
333
|
-
*/
|
|
334
|
-
PAGE_RES_IT *it_;
|
|
335
|
-
/**
|
|
336
|
-
* The current input WERD being iterated. If there is an output from OCR,
|
|
337
|
-
* then word_ is nullptr. Owned by the API
|
|
338
|
-
*/
|
|
339
|
-
WERD *word_;
|
|
340
|
-
/** The length of the current word_. */
|
|
341
|
-
int word_length_;
|
|
342
|
-
/** The current blob index within the word. */
|
|
343
|
-
int blob_index_;
|
|
344
|
-
/**
|
|
345
|
-
* Iterator to the blobs within the word. If nullptr, then we are iterating
|
|
346
|
-
* OCR results in the box_word.
|
|
347
|
-
* Owned by this ResultIterator.
|
|
348
|
-
*/
|
|
349
|
-
C_BLOB_IT *cblob_it_;
|
|
350
|
-
/** Control over what to include in bounding boxes. */
|
|
351
|
-
bool include_upper_dots_;
|
|
352
|
-
bool include_lower_dots_;
|
|
353
|
-
/** Parameters saved from the Thresholder. Needed to rebuild coordinates.*/
|
|
354
|
-
int scale_;
|
|
355
|
-
int scaled_yres_;
|
|
356
|
-
int rect_left_;
|
|
357
|
-
int rect_top_;
|
|
358
|
-
int rect_width_;
|
|
359
|
-
int rect_height_;
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
} // namespace tesseract.
|
|
363
|
-
|
|
364
|
-
#endif // TESSERACT_CCMAIN_PAGEITERATOR_H_
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// File: publictypes.h
|
|
3
|
-
// Description: Types used in both the API and internally
|
|
4
|
-
// Author: Ray Smith
|
|
5
|
-
//
|
|
6
|
-
// (C) Copyright 2010, Google Inc.
|
|
7
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
// you may not use this file except in compliance with the License.
|
|
9
|
-
// You may obtain a copy of the License at
|
|
10
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
// See the License for the specific language governing permissions and
|
|
15
|
-
// limitations under the License.
|
|
16
|
-
|
|
17
|
-
#ifndef TESSERACT_CCSTRUCT_PUBLICTYPES_H_
|
|
18
|
-
#define TESSERACT_CCSTRUCT_PUBLICTYPES_H_
|
|
19
|
-
|
|
20
|
-
namespace tesseract {
|
|
21
|
-
|
|
22
|
-
// This file contains types that are used both by the API and internally
|
|
23
|
-
// to Tesseract. In order to decouple the API from Tesseract and prevent cyclic
|
|
24
|
-
// dependencies, THIS FILE SHOULD NOT DEPEND ON ANY OTHER PART OF TESSERACT.
|
|
25
|
-
// Restated: It is OK for low-level Tesseract files to include publictypes.h,
|
|
26
|
-
// but not for the low-level tesseract code to include top-level API code.
|
|
27
|
-
// This file should not use other Tesseract types, as that would drag
|
|
28
|
-
// their includes into the API-level.
|
|
29
|
-
|
|
30
|
-
/** Number of printers' points in an inch. The unit of the pointsize return. */
|
|
31
|
-
constexpr int kPointsPerInch = 72;
|
|
32
|
-
/**
|
|
33
|
-
* Minimum believable resolution. Used as a default if there is no other
|
|
34
|
-
* information, as it is safer to under-estimate than over-estimate.
|
|
35
|
-
*/
|
|
36
|
-
constexpr int kMinCredibleResolution = 70;
|
|
37
|
-
/** Maximum believable resolution. */
|
|
38
|
-
constexpr int kMaxCredibleResolution = 2400;
|
|
39
|
-
/**
|
|
40
|
-
* Ratio between median blob size and likely resolution. Used to estimate
|
|
41
|
-
* resolution when none is provided. This is basically 1/usual text size in
|
|
42
|
-
* inches. */
|
|
43
|
-
constexpr int kResolutionEstimationFactor = 10;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Possible types for a POLY_BLOCK or ColPartition.
|
|
47
|
-
* Must be kept in sync with kPBColors in polyblk.cpp and PTIs*Type functions
|
|
48
|
-
* below, as well as kPolyBlockNames in layout_test.cc.
|
|
49
|
-
* Used extensively by ColPartition, and POLY_BLOCK.
|
|
50
|
-
*/
|
|
51
|
-
enum PolyBlockType {
|
|
52
|
-
PT_UNKNOWN, // Type is not yet known. Keep as the first element.
|
|
53
|
-
PT_FLOWING_TEXT, // Text that lives inside a column.
|
|
54
|
-
PT_HEADING_TEXT, // Text that spans more than one column.
|
|
55
|
-
PT_PULLOUT_TEXT, // Text that is in a cross-column pull-out region.
|
|
56
|
-
PT_EQUATION, // Partition belonging to an equation region.
|
|
57
|
-
PT_INLINE_EQUATION, // Partition has inline equation.
|
|
58
|
-
PT_TABLE, // Partition belonging to a table region.
|
|
59
|
-
PT_VERTICAL_TEXT, // Text-line runs vertically.
|
|
60
|
-
PT_CAPTION_TEXT, // Text that belongs to an image.
|
|
61
|
-
PT_FLOWING_IMAGE, // Image that lives inside a column.
|
|
62
|
-
PT_HEADING_IMAGE, // Image that spans more than one column.
|
|
63
|
-
PT_PULLOUT_IMAGE, // Image that is in a cross-column pull-out region.
|
|
64
|
-
PT_HORZ_LINE, // Horizontal Line.
|
|
65
|
-
PT_VERT_LINE, // Vertical Line.
|
|
66
|
-
PT_NOISE, // Lies outside of any column.
|
|
67
|
-
PT_COUNT
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
/** Returns true if PolyBlockType is of line type */
|
|
71
|
-
inline bool PTIsLineType(PolyBlockType type) {
|
|
72
|
-
return type == PT_HORZ_LINE || type == PT_VERT_LINE;
|
|
73
|
-
}
|
|
74
|
-
/** Returns true if PolyBlockType is of image type */
|
|
75
|
-
inline bool PTIsImageType(PolyBlockType type) {
|
|
76
|
-
return type == PT_FLOWING_IMAGE || type == PT_HEADING_IMAGE ||
|
|
77
|
-
type == PT_PULLOUT_IMAGE;
|
|
78
|
-
}
|
|
79
|
-
/** Returns true if PolyBlockType is of text type */
|
|
80
|
-
inline bool PTIsTextType(PolyBlockType type) {
|
|
81
|
-
return type == PT_FLOWING_TEXT || type == PT_HEADING_TEXT ||
|
|
82
|
-
type == PT_PULLOUT_TEXT || type == PT_TABLE ||
|
|
83
|
-
type == PT_VERTICAL_TEXT || type == PT_CAPTION_TEXT ||
|
|
84
|
-
type == PT_INLINE_EQUATION;
|
|
85
|
-
}
|
|
86
|
-
// Returns true if PolyBlockType is of pullout(inter-column) type
|
|
87
|
-
inline bool PTIsPulloutType(PolyBlockType type) {
|
|
88
|
-
return type == PT_PULLOUT_IMAGE || type == PT_PULLOUT_TEXT;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* +------------------+ Orientation Example:
|
|
93
|
-
* | 1 Aaaa Aaaa Aaaa | ====================
|
|
94
|
-
* | Aaa aa aaa aa | To left is a diagram of some (1) English and
|
|
95
|
-
* | aaaaaa A aa aaa. | (2) Chinese text and a (3) photo credit.
|
|
96
|
-
* | 2 |
|
|
97
|
-
* | ####### c c C | Upright Latin characters are represented as A and a.
|
|
98
|
-
* | ####### c c c | '<' represents a latin character rotated
|
|
99
|
-
* | < ####### c c c | anti-clockwise 90 degrees.
|
|
100
|
-
* | < ####### c c |
|
|
101
|
-
* | < ####### . c | Upright Chinese characters are represented C and c.
|
|
102
|
-
* | 3 ####### c |
|
|
103
|
-
* +------------------+ NOTA BENE: enum values here should match goodoc.proto
|
|
104
|
-
|
|
105
|
-
* If you orient your head so that "up" aligns with Orientation,
|
|
106
|
-
* then the characters will appear "right side up" and readable.
|
|
107
|
-
*
|
|
108
|
-
* In the example above, both the English and Chinese paragraphs are oriented
|
|
109
|
-
* so their "up" is the top of the page (page up). The photo credit is read
|
|
110
|
-
* with one's head turned leftward ("up" is to page left).
|
|
111
|
-
*
|
|
112
|
-
* The values of this enum match the convention of Tesseract's osdetect.h
|
|
113
|
-
*/
|
|
114
|
-
enum Orientation {
|
|
115
|
-
ORIENTATION_PAGE_UP = 0,
|
|
116
|
-
ORIENTATION_PAGE_RIGHT = 1,
|
|
117
|
-
ORIENTATION_PAGE_DOWN = 2,
|
|
118
|
-
ORIENTATION_PAGE_LEFT = 3,
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* The grapheme clusters within a line of text are laid out logically
|
|
123
|
-
* in this direction, judged when looking at the text line rotated so that
|
|
124
|
-
* its Orientation is "page up".
|
|
125
|
-
*
|
|
126
|
-
* For English text, the writing direction is left-to-right. For the
|
|
127
|
-
* Chinese text in the above example, the writing direction is top-to-bottom.
|
|
128
|
-
*/
|
|
129
|
-
enum WritingDirection {
|
|
130
|
-
WRITING_DIRECTION_LEFT_TO_RIGHT = 0,
|
|
131
|
-
WRITING_DIRECTION_RIGHT_TO_LEFT = 1,
|
|
132
|
-
WRITING_DIRECTION_TOP_TO_BOTTOM = 2,
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* The text lines are read in the given sequence.
|
|
137
|
-
*
|
|
138
|
-
* In English, the order is top-to-bottom.
|
|
139
|
-
* In Chinese, vertical text lines are read right-to-left. Mongolian is
|
|
140
|
-
* written in vertical columns top to bottom like Chinese, but the lines
|
|
141
|
-
* order left-to right.
|
|
142
|
-
*
|
|
143
|
-
* Note that only some combinations make sense. For example,
|
|
144
|
-
* WRITING_DIRECTION_LEFT_TO_RIGHT implies TEXTLINE_ORDER_TOP_TO_BOTTOM
|
|
145
|
-
*/
|
|
146
|
-
enum TextlineOrder {
|
|
147
|
-
TEXTLINE_ORDER_LEFT_TO_RIGHT = 0,
|
|
148
|
-
TEXTLINE_ORDER_RIGHT_TO_LEFT = 1,
|
|
149
|
-
TEXTLINE_ORDER_TOP_TO_BOTTOM = 2,
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Possible modes for page layout analysis. These *must* be kept in order
|
|
154
|
-
* of decreasing amount of layout analysis to be done, except for OSD_ONLY,
|
|
155
|
-
* so that the inequality test macros below work.
|
|
156
|
-
*/
|
|
157
|
-
enum PageSegMode {
|
|
158
|
-
PSM_OSD_ONLY = 0, ///< Orientation and script detection only.
|
|
159
|
-
PSM_AUTO_OSD = 1, ///< Automatic page segmentation with orientation and
|
|
160
|
-
///< script detection. (OSD)
|
|
161
|
-
PSM_AUTO_ONLY = 2, ///< Automatic page segmentation, but no OSD, or OCR.
|
|
162
|
-
PSM_AUTO = 3, ///< Fully automatic page segmentation, but no OSD.
|
|
163
|
-
PSM_SINGLE_COLUMN = 4, ///< Assume a single column of text of variable sizes.
|
|
164
|
-
PSM_SINGLE_BLOCK_VERT_TEXT = 5, ///< Assume a single uniform block of
|
|
165
|
-
///< vertically aligned text.
|
|
166
|
-
PSM_SINGLE_BLOCK = 6, ///< Assume a single uniform block of text. (Default.)
|
|
167
|
-
PSM_SINGLE_LINE = 7, ///< Treat the image as a single text line.
|
|
168
|
-
PSM_SINGLE_WORD = 8, ///< Treat the image as a single word.
|
|
169
|
-
PSM_CIRCLE_WORD = 9, ///< Treat the image as a single word in a circle.
|
|
170
|
-
PSM_SINGLE_CHAR = 10, ///< Treat the image as a single character.
|
|
171
|
-
PSM_SPARSE_TEXT =
|
|
172
|
-
11, ///< Find as much text as possible in no particular order.
|
|
173
|
-
PSM_SPARSE_TEXT_OSD = 12, ///< Sparse text with orientation and script det.
|
|
174
|
-
PSM_RAW_LINE = 13, ///< Treat the image as a single text line, bypassing
|
|
175
|
-
///< hacks that are Tesseract-specific.
|
|
176
|
-
|
|
177
|
-
PSM_COUNT ///< Number of enum entries.
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Inline functions that act on a PageSegMode to determine whether components of
|
|
182
|
-
* layout analysis are enabled.
|
|
183
|
-
* *Depend critically on the order of elements of PageSegMode.*
|
|
184
|
-
* NOTE that arg is an int for compatibility with INT_PARAM.
|
|
185
|
-
*/
|
|
186
|
-
inline bool PSM_OSD_ENABLED(int pageseg_mode) {
|
|
187
|
-
return pageseg_mode <= PSM_AUTO_OSD || pageseg_mode == PSM_SPARSE_TEXT_OSD;
|
|
188
|
-
}
|
|
189
|
-
inline bool PSM_ORIENTATION_ENABLED(int pageseg_mode) {
|
|
190
|
-
return pageseg_mode <= PSM_AUTO || pageseg_mode == PSM_SPARSE_TEXT_OSD;
|
|
191
|
-
}
|
|
192
|
-
inline bool PSM_COL_FIND_ENABLED(int pageseg_mode) {
|
|
193
|
-
return pageseg_mode >= PSM_AUTO_OSD && pageseg_mode <= PSM_AUTO;
|
|
194
|
-
}
|
|
195
|
-
inline bool PSM_SPARSE(int pageseg_mode) {
|
|
196
|
-
return pageseg_mode == PSM_SPARSE_TEXT || pageseg_mode == PSM_SPARSE_TEXT_OSD;
|
|
197
|
-
}
|
|
198
|
-
inline bool PSM_BLOCK_FIND_ENABLED(int pageseg_mode) {
|
|
199
|
-
return pageseg_mode >= PSM_AUTO_OSD && pageseg_mode <= PSM_SINGLE_COLUMN;
|
|
200
|
-
}
|
|
201
|
-
inline bool PSM_LINE_FIND_ENABLED(int pageseg_mode) {
|
|
202
|
-
return pageseg_mode >= PSM_AUTO_OSD && pageseg_mode <= PSM_SINGLE_BLOCK;
|
|
203
|
-
}
|
|
204
|
-
inline bool PSM_WORD_FIND_ENABLED(int pageseg_mode) {
|
|
205
|
-
return (pageseg_mode >= PSM_AUTO_OSD && pageseg_mode <= PSM_SINGLE_LINE) ||
|
|
206
|
-
pageseg_mode == PSM_SPARSE_TEXT || pageseg_mode == PSM_SPARSE_TEXT_OSD;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* enum of the elements of the page hierarchy, used in ResultIterator
|
|
211
|
-
* to provide functions that operate on each level without having to
|
|
212
|
-
* have 5x as many functions.
|
|
213
|
-
*/
|
|
214
|
-
enum PageIteratorLevel {
|
|
215
|
-
RIL_BLOCK, // Block of text/image/separator line.
|
|
216
|
-
RIL_PARA, // Paragraph within a block.
|
|
217
|
-
RIL_TEXTLINE, // Line within a paragraph.
|
|
218
|
-
RIL_WORD, // Word within a textline.
|
|
219
|
-
RIL_SYMBOL // Symbol/character within a word.
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* JUSTIFICATION_UNKNOWN
|
|
224
|
-
* The alignment is not clearly one of the other options. This could happen
|
|
225
|
-
* for example if there are only one or two lines of text or the text looks
|
|
226
|
-
* like source code or poetry.
|
|
227
|
-
*
|
|
228
|
-
* NOTA BENE: Fully justified paragraphs (text aligned to both left and right
|
|
229
|
-
* margins) are marked by Tesseract with JUSTIFICATION_LEFT if their text
|
|
230
|
-
* is written with a left-to-right script and with JUSTIFICATION_RIGHT if
|
|
231
|
-
* their text is written in a right-to-left script.
|
|
232
|
-
*
|
|
233
|
-
* Interpretation for text read in vertical lines:
|
|
234
|
-
* "Left" is wherever the starting reading position is.
|
|
235
|
-
*
|
|
236
|
-
* JUSTIFICATION_LEFT
|
|
237
|
-
* Each line, except possibly the first, is flush to the same left tab stop.
|
|
238
|
-
*
|
|
239
|
-
* JUSTIFICATION_CENTER
|
|
240
|
-
* The text lines of the paragraph are centered about a line going
|
|
241
|
-
* down through their middle of the text lines.
|
|
242
|
-
*
|
|
243
|
-
* JUSTIFICATION_RIGHT
|
|
244
|
-
* Each line, except possibly the first, is flush to the same right tab stop.
|
|
245
|
-
*/
|
|
246
|
-
enum ParagraphJustification {
|
|
247
|
-
JUSTIFICATION_UNKNOWN,
|
|
248
|
-
JUSTIFICATION_LEFT,
|
|
249
|
-
JUSTIFICATION_CENTER,
|
|
250
|
-
JUSTIFICATION_RIGHT,
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* When Tesseract/Cube is initialized we can choose to instantiate/load/run
|
|
255
|
-
* only the Tesseract part, only the Cube part or both along with the combiner.
|
|
256
|
-
* The preference of which engine to use is stored in tessedit_ocr_engine_mode.
|
|
257
|
-
*
|
|
258
|
-
* ATTENTION: When modifying this enum, please make sure to make the
|
|
259
|
-
* appropriate changes to all the enums mirroring it (e.g. OCREngine in
|
|
260
|
-
* cityblock/workflow/detection/detection_storage.proto). Such enums will
|
|
261
|
-
* mention the connection to OcrEngineMode in the comments.
|
|
262
|
-
*/
|
|
263
|
-
enum OcrEngineMode {
|
|
264
|
-
OEM_TESSERACT_ONLY, // Run Tesseract only - fastest; deprecated
|
|
265
|
-
OEM_LSTM_ONLY, // Run just the LSTM line recognizer.
|
|
266
|
-
OEM_TESSERACT_LSTM_COMBINED, // Run the LSTM recognizer, but allow fallback
|
|
267
|
-
// to Tesseract when things get difficult.
|
|
268
|
-
// deprecated
|
|
269
|
-
OEM_DEFAULT, // Specify this mode when calling init_*(),
|
|
270
|
-
// to indicate that any of the above modes
|
|
271
|
-
// should be automatically inferred from the
|
|
272
|
-
// variables in the language-specific config,
|
|
273
|
-
// command-line configs, or if not specified
|
|
274
|
-
// in any of the above should be set to the
|
|
275
|
-
// default OEM_TESSERACT_ONLY.
|
|
276
|
-
OEM_COUNT // Number of OEMs
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
} // namespace tesseract.
|
|
280
|
-
|
|
281
|
-
#endif // TESSERACT_CCSTRUCT_PUBLICTYPES_H_
|