tesseract  v4.0.0-17-g361f3264
Open Source OCR Engine
capi.h
1 // File: capi.h
3 // Description: C-API TessBaseAPI
4 //
5 // (C) Copyright 2012, Google Inc.
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
17 
18 #ifndef API_CAPI_H_
19 #define API_CAPI_H_
20 
21 #if defined(TESSERACT_API_BASEAPI_H_) && !defined(TESS_CAPI_INCLUDE_BASEAPI)
22 # define TESS_CAPI_INCLUDE_BASEAPI
23 #endif
24 
25 #ifdef TESS_CAPI_INCLUDE_BASEAPI
26 # include "baseapi.h"
27 # include "ocrclass.h"
28 # include "pageiterator.h"
29 # include "resultiterator.h"
30 # include "renderer.h"
31 #else
32 # include "platform.h"
33 # include <stdbool.h>
34 # include <stdio.h>
35 #endif
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #ifndef TESS_CALL
42 # if defined(WIN32)
43 # define TESS_CALL __cdecl
44 # else
45 # define TESS_CALL
46 # endif
47 #endif
48 
49 #ifndef BOOL
50 # define BOOL int
51 # define TRUE 1
52 # define FALSE 0
53 #endif
54 
55 #ifdef TESS_CAPI_INCLUDE_BASEAPI
56 typedef tesseract::TessResultRenderer TessResultRenderer;
57 typedef tesseract::TessTextRenderer TessTextRenderer;
58 typedef tesseract::TessHOcrRenderer TessHOcrRenderer;
59 typedef tesseract::TessPDFRenderer TessPDFRenderer;
60 typedef tesseract::TessUnlvRenderer TessUnlvRenderer;
61 typedef tesseract::TessBoxTextRenderer TessBoxTextRenderer;
62 typedef tesseract::TessBaseAPI TessBaseAPI;
63 typedef tesseract::PageIterator TessPageIterator;
64 typedef tesseract::ResultIterator TessResultIterator;
65 typedef tesseract::MutableIterator TessMutableIterator;
66 typedef tesseract::ChoiceIterator TessChoiceIterator;
67 typedef tesseract::OcrEngineMode TessOcrEngineMode;
68 typedef tesseract::PageSegMode TessPageSegMode;
69 typedef tesseract::ImageThresholder TessImageThresholder;
70 typedef tesseract::PageIteratorLevel TessPageIteratorLevel;
71 typedef tesseract::DictFunc TessDictFunc;
72 typedef tesseract::ProbabilityInContextFunc TessProbabilityInContextFunc;
73 // typedef tesseract::ParamsModelClassifyFunc TessParamsModelClassifyFunc;
74 typedef tesseract::FillLatticeFunc TessFillLatticeFunc;
75 typedef tesseract::Dawg TessDawg;
76 typedef tesseract::TruthCallback TessTruthCallback;
77 typedef tesseract::Orientation TessOrientation;
78 typedef tesseract::ParagraphJustification TessParagraphJustification;
79 typedef tesseract::WritingDirection TessWritingDirection;
80 typedef tesseract::TextlineOrder TessTextlineOrder;
81 typedef PolyBlockType TessPolyBlockType;
82 #else
83 typedef struct TessResultRenderer TessResultRenderer;
84 typedef struct TessTextRenderer TessTextRenderer;
85 typedef struct TessHOcrRenderer TessHOcrRenderer;
86 typedef struct TessPDFRenderer TessPDFRenderer;
87 typedef struct TessUnlvRenderer TessUnlvRenderer;
88 typedef struct TessBoxTextRenderer TessBoxTextRenderer;
89 typedef struct TessBaseAPI TessBaseAPI;
90 typedef struct TessPageIterator TessPageIterator;
91 typedef struct TessResultIterator TessResultIterator;
92 typedef struct TessMutableIterator TessMutableIterator;
93 typedef struct TessChoiceIterator TessChoiceIterator;
94 typedef enum TessOcrEngineMode { OEM_TESSERACT_ONLY, OEM_LSTM_ONLY, OEM_TESSERACT_LSTM_COMBINED, OEM_DEFAULT } TessOcrEngineMode;
95 typedef enum TessPageSegMode { PSM_OSD_ONLY, PSM_AUTO_OSD, PSM_AUTO_ONLY, PSM_AUTO, PSM_SINGLE_COLUMN, PSM_SINGLE_BLOCK_VERT_TEXT,
96  PSM_SINGLE_BLOCK, PSM_SINGLE_LINE, PSM_SINGLE_WORD, PSM_CIRCLE_WORD, PSM_SINGLE_CHAR, PSM_SPARSE_TEXT,
97  PSM_SPARSE_TEXT_OSD, PSM_COUNT } TessPageSegMode;
98 typedef enum TessPageIteratorLevel { RIL_BLOCK, RIL_PARA, RIL_TEXTLINE, RIL_WORD, RIL_SYMBOL} TessPageIteratorLevel;
99 typedef enum TessPolyBlockType { PT_UNKNOWN, PT_FLOWING_TEXT, PT_HEADING_TEXT, PT_PULLOUT_TEXT, PT_EQUATION, PT_INLINE_EQUATION,
100  PT_TABLE, PT_VERTICAL_TEXT, PT_CAPTION_TEXT, PT_FLOWING_IMAGE, PT_HEADING_IMAGE,
101  PT_PULLOUT_IMAGE, PT_HORZ_LINE, PT_VERT_LINE, PT_NOISE, PT_COUNT } TessPolyBlockType;
102 typedef enum TessOrientation { ORIENTATION_PAGE_UP, ORIENTATION_PAGE_RIGHT, ORIENTATION_PAGE_DOWN, ORIENTATION_PAGE_LEFT } TessOrientation;
103 typedef enum TessParagraphJustification { JUSTIFICATION_UNKNOWN, JUSTIFICATION_LEFT, JUSTIFICATION_CENTER, JUSTIFICATION_RIGHT } TessParagraphJustification;
104 typedef enum TessWritingDirection { WRITING_DIRECTION_LEFT_TO_RIGHT, WRITING_DIRECTION_RIGHT_TO_LEFT, WRITING_DIRECTION_TOP_TO_BOTTOM } TessWritingDirection;
105 typedef enum TessTextlineOrder { TEXTLINE_ORDER_LEFT_TO_RIGHT, TEXTLINE_ORDER_RIGHT_TO_LEFT, TEXTLINE_ORDER_TOP_TO_BOTTOM } TessTextlineOrder;
106 typedef struct ETEXT_DESC ETEXT_DESC;
107 #endif
108 
109 typedef bool (*TessCancelFunc)(void* cancel_this, int words);
110 typedef bool (*TessProgressFunc)(ETEXT_DESC* ths, int left, int right, int top,
111  int bottom);
112 
113 struct Pix;
114 struct Boxa;
115 struct Pixa;
116 
117 /* General free functions */
118 
119 TESS_API const char*
120  TESS_CALL TessVersion();
121 TESS_API void TESS_CALL TessDeleteText(char* text);
122 TESS_API void TESS_CALL TessDeleteTextArray(char** arr);
123 TESS_API void TESS_CALL TessDeleteIntArray(int* arr);
124 
125 /* Renderer API */
126 TESS_API TessResultRenderer* TESS_CALL TessTextRendererCreate(const char* outputbase);
127 TESS_API TessResultRenderer* TESS_CALL TessHOcrRendererCreate(const char* outputbase);
128 TESS_API TessResultRenderer* TESS_CALL TessHOcrRendererCreate2(const char* outputbase, BOOL font_info);
129 TESS_API TessResultRenderer* TESS_CALL TessPDFRendererCreate(const char* outputbase, const char* datadir,
130  BOOL textonly);
131 TESS_API TessResultRenderer* TESS_CALL TessUnlvRendererCreate(const char* outputbase);
132 TESS_API TessResultRenderer* TESS_CALL TessBoxTextRendererCreate(const char* outputbase);
133 
134 TESS_API void TESS_CALL TessDeleteResultRenderer(TessResultRenderer* renderer);
135 TESS_API void TESS_CALL TessResultRendererInsert(TessResultRenderer* renderer, TessResultRenderer* next);
136 TESS_API TessResultRenderer*
137  TESS_CALL TessResultRendererNext(TessResultRenderer* renderer);
138 TESS_API BOOL TESS_CALL TessResultRendererBeginDocument(TessResultRenderer* renderer, const char* title);
139 TESS_API BOOL TESS_CALL TessResultRendererAddImage(TessResultRenderer* renderer, TessBaseAPI* api);
140 TESS_API BOOL TESS_CALL TessResultRendererEndDocument(TessResultRenderer* renderer);
141 
142 TESS_API const char* TESS_CALL TessResultRendererExtention(TessResultRenderer* renderer);
143 TESS_API const char* TESS_CALL TessResultRendererTitle(TessResultRenderer* renderer);
144 TESS_API int TESS_CALL TessResultRendererImageNum(TessResultRenderer* renderer);
145 
146 /* Base API */
147 
148 TESS_API TessBaseAPI*
149  TESS_CALL TessBaseAPICreate();
150 TESS_API void TESS_CALL TessBaseAPIDelete(TessBaseAPI* handle);
151 
152 TESS_API size_t TESS_CALL TessBaseAPIGetOpenCLDevice(TessBaseAPI* handle, void **device);
153 
154 TESS_API void TESS_CALL TessBaseAPISetInputName(TessBaseAPI* handle, const char* name);
155 TESS_API const char* TESS_CALL TessBaseAPIGetInputName(TessBaseAPI* handle);
156 
157 TESS_API void TESS_CALL TessBaseAPISetInputImage(TessBaseAPI* handle, struct Pix* pix);
158 TESS_API struct Pix* TESS_CALL TessBaseAPIGetInputImage(TessBaseAPI* handle);
159 
160 TESS_API int TESS_CALL TessBaseAPIGetSourceYResolution(TessBaseAPI* handle);
161 TESS_API const char* TESS_CALL TessBaseAPIGetDatapath(TessBaseAPI* handle);
162 
163 TESS_API void TESS_CALL TessBaseAPISetOutputName(TessBaseAPI* handle, const char* name);
164 
165 TESS_API BOOL TESS_CALL TessBaseAPISetVariable(TessBaseAPI* handle, const char* name, const char* value);
166 TESS_API BOOL TESS_CALL TessBaseAPISetDebugVariable(TessBaseAPI* handle, const char* name, const char* value);
167 
168 TESS_API BOOL TESS_CALL TessBaseAPIGetIntVariable(const TessBaseAPI* handle, const char* name, int* value);
169 TESS_API BOOL TESS_CALL TessBaseAPIGetBoolVariable(const TessBaseAPI* handle, const char* name, BOOL* value);
170 TESS_API BOOL TESS_CALL TessBaseAPIGetDoubleVariable(const TessBaseAPI* handle, const char* name, double* value);
171 TESS_API const char*
172  TESS_CALL TessBaseAPIGetStringVariable(const TessBaseAPI* handle, const char* name);
173 
174 TESS_API void TESS_CALL TessBaseAPIPrintVariables(const TessBaseAPI* handle, FILE* fp);
175 TESS_API BOOL TESS_CALL TessBaseAPIPrintVariablesToFile(const TessBaseAPI* handle, const char* filename);
176 
177 #ifdef TESS_CAPI_INCLUDE_BASEAPI
178 
179 TESS_API BOOL TESS_CALL TessBaseAPIGetVariableAsString(TessBaseAPI* handle, const char* name, STRING* val);
180 
181 TESS_API int TESS_CALL TessBaseAPIInit(TessBaseAPI* handle, const char* datapath, const char* language,
182  TessOcrEngineMode mode, char** configs, int configs_size,
183  const STRING* vars_vec, size_t vars_vec_size,
184  const STRING* vars_values, size_t vars_values_size, BOOL set_only_init_params);
185 
186 #endif // def TESS_CAPI_INCLUDE_BASEAPI
187 
188 TESS_API int TESS_CALL TessBaseAPIInit1(TessBaseAPI* handle, const char* datapath, const char* language, TessOcrEngineMode oem,
189  char** configs, int configs_size);
190 TESS_API int TESS_CALL TessBaseAPIInit2(TessBaseAPI* handle, const char* datapath, const char* language, TessOcrEngineMode oem);
191 TESS_API int TESS_CALL TessBaseAPIInit3(TessBaseAPI* handle, const char* datapath, const char* language);
192 
193 TESS_API int TESS_CALL TessBaseAPIInit4(TessBaseAPI* handle, const char* datapath, const char* language, TessOcrEngineMode mode,
194  char** configs, int configs_size,
195  char** vars_vec, char** vars_values, size_t vars_vec_size,
196  BOOL set_only_non_debug_params);
197 
198 TESS_API const char*
199  TESS_CALL TessBaseAPIGetInitLanguagesAsString(const TessBaseAPI* handle);
200 TESS_API char**
201  TESS_CALL TessBaseAPIGetLoadedLanguagesAsVector(const TessBaseAPI* handle);
202 TESS_API char**
203  TESS_CALL TessBaseAPIGetAvailableLanguagesAsVector(const TessBaseAPI* handle);
204 
205 TESS_API int TESS_CALL TessBaseAPIInitLangMod(TessBaseAPI* handle, const char* datapath, const char* language);
206 TESS_API void TESS_CALL TessBaseAPIInitForAnalysePage(TessBaseAPI* handle);
207 
208 TESS_API void TESS_CALL TessBaseAPIReadConfigFile(TessBaseAPI* handle, const char* filename);
209 TESS_API void TESS_CALL TessBaseAPIReadDebugConfigFile(TessBaseAPI* handle, const char* filename);
210 
211 TESS_API void TESS_CALL TessBaseAPISetPageSegMode(TessBaseAPI* handle, TessPageSegMode mode);
212 TESS_API TessPageSegMode
213  TESS_CALL TessBaseAPIGetPageSegMode(const TessBaseAPI* handle);
214 
215 TESS_API char* TESS_CALL TessBaseAPIRect(TessBaseAPI* handle, const unsigned char* imagedata,
216  int bytes_per_pixel, int bytes_per_line,
217  int left, int top, int width, int height);
218 
219 TESS_API void TESS_CALL TessBaseAPIClearAdaptiveClassifier(TessBaseAPI* handle);
220 
221 TESS_API void TESS_CALL TessBaseAPISetImage(TessBaseAPI* handle, const unsigned char* imagedata, int width, int height,
222  int bytes_per_pixel, int bytes_per_line);
223 TESS_API void TESS_CALL TessBaseAPISetImage2(TessBaseAPI* handle, struct Pix* pix);
224 
225 TESS_API void TESS_CALL TessBaseAPISetSourceResolution(TessBaseAPI* handle, int ppi);
226 
227 TESS_API void TESS_CALL TessBaseAPISetRectangle(TessBaseAPI* handle, int left, int top, int width, int height);
228 
229 #ifdef TESS_CAPI_INCLUDE_BASEAPI
230 TESS_API void TESS_CALL TessBaseAPISetThresholder(TessBaseAPI* handle, TessImageThresholder* thresholder);
231 #endif
232 
233 TESS_API struct Pix*
234  TESS_CALL TessBaseAPIGetThresholdedImage(TessBaseAPI* handle);
235 TESS_API struct Boxa*
236  TESS_CALL TessBaseAPIGetRegions(TessBaseAPI* handle, struct Pixa** pixa);
237 TESS_API struct Boxa*
238  TESS_CALL TessBaseAPIGetTextlines(TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
239 TESS_API struct Boxa*
240  TESS_CALL TessBaseAPIGetTextlines1(TessBaseAPI* handle, const BOOL raw_image, const int raw_padding,
241  struct Pixa** pixa, int** blockids, int** paraids);
242 TESS_API struct Boxa*
243  TESS_CALL TessBaseAPIGetStrips(TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
244 TESS_API struct Boxa*
245  TESS_CALL TessBaseAPIGetWords(TessBaseAPI* handle, struct Pixa** pixa);
246 TESS_API struct Boxa*
247  TESS_CALL TessBaseAPIGetConnectedComponents(TessBaseAPI* handle, struct Pixa** cc);
248 TESS_API struct Boxa*
249  TESS_CALL TessBaseAPIGetComponentImages(TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
250  struct Pixa** pixa, int** blockids);
251 TESS_API struct Boxa*
252  TESS_CALL TessBaseAPIGetComponentImages1(TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
253  const BOOL raw_image, const int raw_padding,
254  struct Pixa** pixa, int** blockids, int** paraids);
255 
256 TESS_API int TESS_CALL TessBaseAPIGetThresholdedImageScaleFactor(const TessBaseAPI* handle);
257 
258 TESS_API TessPageIterator*
259  TESS_CALL TessBaseAPIAnalyseLayout(TessBaseAPI* handle);
260 
261 TESS_API int TESS_CALL TessBaseAPIRecognize(TessBaseAPI* handle, ETEXT_DESC* monitor);
262 
263 #ifndef DISABLED_LEGACY_ENGINE
264 TESS_API int TESS_CALL TessBaseAPIRecognizeForChopTest(TessBaseAPI* handle, ETEXT_DESC* monitor);
265 #endif
266 
267 TESS_API BOOL TESS_CALL TessBaseAPIProcessPages(TessBaseAPI* handle, const char* filename, const char* retry_config,
268  int timeout_millisec, TessResultRenderer* renderer);
269 TESS_API BOOL TESS_CALL TessBaseAPIProcessPage(TessBaseAPI* handle, struct Pix* pix, int page_index, const char* filename,
270  const char* retry_config, int timeout_millisec, TessResultRenderer* renderer);
271 
272 TESS_API TessResultIterator*
273  TESS_CALL TessBaseAPIGetIterator(TessBaseAPI* handle);
274 TESS_API TessMutableIterator*
275  TESS_CALL TessBaseAPIGetMutableIterator(TessBaseAPI* handle);
276 
277 TESS_API char* TESS_CALL TessBaseAPIGetUTF8Text(TessBaseAPI* handle);
278 TESS_API char* TESS_CALL TessBaseAPIGetHOCRText(TessBaseAPI* handle, int page_number);
279 
280 TESS_API char* TESS_CALL TessBaseAPIGetBoxText(TessBaseAPI* handle, int page_number);
281 
282 TESS_API char* TESS_CALL TessBaseAPIGetUNLVText(TessBaseAPI* handle);
283 TESS_API int TESS_CALL TessBaseAPIMeanTextConf(TessBaseAPI* handle);
284 
285 TESS_API int* TESS_CALL TessBaseAPIAllWordConfidences(TessBaseAPI* handle);
286 
287 #ifndef DISABLED_LEGACY_ENGINE
288 TESS_API BOOL TESS_CALL TessBaseAPIAdaptToWordStr(TessBaseAPI* handle, TessPageSegMode mode, const char* wordstr);
289 #endif // ndef DISABLED_LEGACY_ENGINE
290 
291 TESS_API void TESS_CALL TessBaseAPIClear(TessBaseAPI* handle);
292 TESS_API void TESS_CALL TessBaseAPIEnd(TessBaseAPI* handle);
293 
294 TESS_API int TESS_CALL TessBaseAPIIsValidWord(TessBaseAPI* handle, const char* word);
295 TESS_API BOOL TESS_CALL TessBaseAPIGetTextDirection(TessBaseAPI* handle, int* out_offset, float* out_slope);
296 
297 
298 #ifdef TESS_CAPI_INCLUDE_BASEAPI
299 
300 TESS_API void TESS_CALL TessBaseAPISetDictFunc(TessBaseAPI* handle, TessDictFunc f);
301 
302 TESS_API void TESS_CALL TessBaseAPIClearPersistentCache(TessBaseAPI* handle);
303 
304 TESS_API void TESS_CALL TessBaseAPISetProbabilityInContextFunc(TessBaseAPI* handle, TessProbabilityInContextFunc f);
305 
306 // Call TessDeleteText(*best_script_name) to free memory allocated by this function
307 TESS_API BOOL TESS_CALL TessBaseAPIDetectOrientationScript(TessBaseAPI* handle,
308  int* orient_deg, float* orient_conf, const char **script_name, float* script_conf);
309 
310 #endif // def TESS_CAPI_INCLUDE_BASEAPI
311 
312 TESS_API const char*
313  TESS_CALL TessBaseAPIGetUnichar(TessBaseAPI* handle, int unichar_id);
314 
315 TESS_API void TESS_CALL TessBaseAPISetMinOrientationMargin(TessBaseAPI* handle, double margin);
316 
317 #ifdef TESS_CAPI_INCLUDE_BASEAPI
318 
319 TESS_API const TessDawg*
320  TESS_CALL TessBaseAPIGetDawg(const TessBaseAPI* handle, int i);
321 
322 TESS_API int TESS_CALL TessBaseAPINumDawgs(const TessBaseAPI* handle);
323 
324 TESS_API TessOcrEngineMode
325  TESS_CALL TessBaseAPIOem(const TessBaseAPI* handle);
326 
327 TESS_API void TESS_CALL TessBaseAPIInitTruthCallback(TessBaseAPI* handle, TessTruthCallback* cb);
328 
329 TESS_API void TESS_CALL TessBaseGetBlockTextOrientations(TessBaseAPI* handle, int** block_orientation, bool** vertical_writing);
330 
331 #endif
332 
333 /* Page iterator */
334 
335 TESS_API void TESS_CALL TessPageIteratorDelete(TessPageIterator* handle);
336 
337 TESS_API TessPageIterator*
338  TESS_CALL TessPageIteratorCopy(const TessPageIterator* handle);
339 
340 TESS_API void TESS_CALL TessPageIteratorBegin(TessPageIterator* handle);
341 
342 TESS_API BOOL TESS_CALL TessPageIteratorNext(TessPageIterator* handle, TessPageIteratorLevel level);
343 
344 TESS_API BOOL TESS_CALL TessPageIteratorIsAtBeginningOf(const TessPageIterator* handle, TessPageIteratorLevel level);
345 
346 TESS_API BOOL TESS_CALL TessPageIteratorIsAtFinalElement(const TessPageIterator* handle, TessPageIteratorLevel level,
347  TessPageIteratorLevel element);
348 
349 TESS_API BOOL TESS_CALL TessPageIteratorBoundingBox(const TessPageIterator* handle, TessPageIteratorLevel level,
350  int* left, int* top, int* right, int* bottom);
351 
352 TESS_API TessPolyBlockType
353  TESS_CALL TessPageIteratorBlockType(const TessPageIterator* handle);
354 
355 TESS_API struct Pix*
356  TESS_CALL TessPageIteratorGetBinaryImage(const TessPageIterator* handle, TessPageIteratorLevel level);
357 
358 TESS_API struct Pix*
359  TESS_CALL TessPageIteratorGetImage(const TessPageIterator* handle, TessPageIteratorLevel level, int padding,
360  struct Pix* original_image, int* left, int* top);
361 
362 TESS_API BOOL TESS_CALL TessPageIteratorBaseline(const TessPageIterator* handle, TessPageIteratorLevel level,
363  int* x1, int* y1, int* x2, int* y2);
364 
365 TESS_API void TESS_CALL TessPageIteratorOrientation(TessPageIterator* handle, TessOrientation* orientation,
366  TessWritingDirection* writing_direction, TessTextlineOrder* textline_order,
367  float* deskew_angle);
368 
369 TESS_API void TESS_CALL TessPageIteratorParagraphInfo(TessPageIterator* handle, TessParagraphJustification* justification,
370  BOOL *is_list_item, BOOL *is_crown, int *first_line_indent);
371 
372 /* Result iterator */
373 
374 TESS_API void TESS_CALL TessResultIteratorDelete(TessResultIterator* handle);
375 TESS_API TessResultIterator*
376  TESS_CALL TessResultIteratorCopy(const TessResultIterator* handle);
377 TESS_API TessPageIterator*
378  TESS_CALL TessResultIteratorGetPageIterator(TessResultIterator* handle);
379 TESS_API const TessPageIterator*
380  TESS_CALL TessResultIteratorGetPageIteratorConst(const TessResultIterator* handle);
381 TESS_API TessChoiceIterator*
382  TESS_CALL TessResultIteratorGetChoiceIterator(const TessResultIterator* handle);
383 
384 TESS_API BOOL TESS_CALL TessResultIteratorNext(TessResultIterator* handle, TessPageIteratorLevel level);
385 TESS_API char* TESS_CALL TessResultIteratorGetUTF8Text(const TessResultIterator* handle, TessPageIteratorLevel level);
386 TESS_API float TESS_CALL TessResultIteratorConfidence(const TessResultIterator* handle, TessPageIteratorLevel level);
387 TESS_API const char*
388  TESS_CALL TessResultIteratorWordRecognitionLanguage(const TessResultIterator* handle);
389 TESS_API const char*
390  TESS_CALL TessResultIteratorWordFontAttributes(const TessResultIterator* handle, BOOL* is_bold, BOOL* is_italic,
391  BOOL* is_underlined, BOOL* is_monospace, BOOL* is_serif,
392  BOOL* is_smallcaps, int* pointsize, int* font_id);
393 
394 TESS_API BOOL TESS_CALL TessResultIteratorWordIsFromDictionary(const TessResultIterator* handle);
395 TESS_API BOOL TESS_CALL TessResultIteratorWordIsNumeric(const TessResultIterator* handle);
396 TESS_API BOOL TESS_CALL TessResultIteratorSymbolIsSuperscript(const TessResultIterator* handle);
397 TESS_API BOOL TESS_CALL TessResultIteratorSymbolIsSubscript(const TessResultIterator* handle);
398 TESS_API BOOL TESS_CALL TessResultIteratorSymbolIsDropcap(const TessResultIterator* handle);
399 
400 TESS_API void TESS_CALL TessChoiceIteratorDelete(TessChoiceIterator* handle);
401 TESS_API BOOL TESS_CALL TessChoiceIteratorNext(TessChoiceIterator* handle);
402 TESS_API const char* TESS_CALL TessChoiceIteratorGetUTF8Text(const TessChoiceIterator* handle);
403 TESS_API float TESS_CALL TessChoiceIteratorConfidence(const TessChoiceIterator* handle);
404 
405 /* Progress monitor */
406 
407 TESS_API ETEXT_DESC* TESS_CALL TessMonitorCreate();
408 TESS_API void TESS_CALL TessMonitorDelete(ETEXT_DESC* monitor);
409 TESS_API void TESS_CALL TessMonitorSetCancelFunc(ETEXT_DESC* monitor, TessCancelFunc cancelFunc);
410 TESS_API void TESS_CALL TessMonitorSetCancelThis(ETEXT_DESC* monitor, void* cancelThis);
411 TESS_API void* TESS_CALL TessMonitorGetCancelThis(ETEXT_DESC* monitor);
412 TESS_API void TESS_CALL TessMonitorSetProgressFunc(ETEXT_DESC* monitor, TessProgressFunc progressFunc);
413 TESS_API int TESS_CALL TessMonitorGetProgress(ETEXT_DESC* monitor);
414 TESS_API void TESS_CALL TessMonitorSetDeadlineMSecs(ETEXT_DESC* monitor, int deadline);
415 
416 
417 #ifndef DISABLED_LEGACY_ENGINE
418 
419 #ifdef TESS_CAPI_INCLUDE_BASEAPI
420 TESS_API void TESS_CALL TessBaseAPISetFillLatticeFunc(TessBaseAPI* handle, TessFillLatticeFunc f);
421 
422 TESS_API void TESS_CALL TessBaseAPIGetFeaturesForBlob(TessBaseAPI* handle, TBLOB* blob, INT_FEATURE_STRUCT* int_features,
423  int* num_features, int* FeatureOutlineIndex);
424 
425 TESS_API ROW* TESS_CALL TessFindRowForBox(BLOCK_LIST* blocks, int left, int top, int right, int bottom);
426 
427 TESS_API void TESS_CALL TessBaseAPIRunAdaptiveClassifier(TessBaseAPI* handle, TBLOB* blob, int num_max_matches,
428  int* unichar_ids, float* ratings, int* num_matches_returned);
429 
430 TESS_API ROW* TESS_CALL TessMakeTessOCRRow(float baseline, float xheight, float descender, float ascender);
431 
432 TESS_API TBLOB*
433  TESS_CALL TessMakeTBLOB(Pix* pix);
434 
435 TESS_API void TESS_CALL TessNormalizeTBLOB(TBLOB* tblob, ROW* row, BOOL numeric_mode);
436 
437 TESS_API BLOCK_LIST*
438  TESS_CALL TessBaseAPIFindLinesCreateBlockList(TessBaseAPI* handle);
439 
440 TESS_API void TESS_CALL TessDeleteBlockList(BLOCK_LIST* block_list);
441 
442 #endif // def TESS_CAPI_INCLUDE_BASEAPI
443 
444 #endif // ndef DISABLED_LEGACY_ENGINE
445 
446 
447 #ifdef __cplusplus
448 }
449 #endif
450 
451 #endif // API_CAPI_H_
WritingDirection
Definition: publictypes.h:135
Definition: renderer.h:144
Definition: dawg.h:119
Definition: renderer.h:155
Definition: resultiterator.h:41
Definition: renderer.h:189
PageIteratorLevel
Definition: publictypes.h:219
Definition: renderer.h:226
void(Wordrec::* FillLatticeFunc)(const MATRIX &ratings, const WERD_CHOICE_LIST &best_choices, const UNICHARSET &unicharset, BlamerBundle *blamer_bundle)
Definition: baseapi.h:86
Definition: renderer.h:45
double(Dict::* ProbabilityInContextFunc)(const char *lang, const char *context, int context_bytes, const char *character, int character_bytes)
Definition: baseapi.h:79
ParagraphJustification
Definition: publictypes.h:251
Definition: strngs.h:45
Orientation
Definition: publictypes.h:120
Definition: ltrresultiterator.h:191
Definition: mutableiterator.h:44
Definition: ocrrow.h:36
int(Dict::* DictFunc)(void *void_dawg_args, const UNICHARSET &unicharset, UNICHAR_ID unichar_id, bool word_end) const
Definition: baseapi.h:76
TextlineOrder
Definition: publictypes.h:152
Definition: intproto.h:132
Definition: blobs.h:268
Definition: ocrclass.h:119
void * cancel_this
monitor-aware progress callback
Definition: ocrclass.h:132
Definition: pageiterator.h:52
Definition: renderer.h:237
OcrEngineMode
Definition: publictypes.h:268
Definition: tesscallback.h:1709
Definition: baseapi.h:101
Definition: thresholder.h:36
PageSegMode
Definition: publictypes.h:163