tesseract  3.05.02
capi.cpp
Go to the documentation of this file.
1 // File: capi.cpp
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 TESS_CAPI_INCLUDE_BASEAPI
19 # define TESS_CAPI_INCLUDE_BASEAPI
20 #endif
21 #include "capi.h"
22 #include "genericvector.h"
23 #include "strngs.h"
24 
26 {
27  return TessBaseAPI::Version();
28 }
29 
31 {
32  delete [] text;
33 }
34 
36 {
37  for (char** pos = arr; *pos != NULL; ++pos)
38  delete [] *pos;
39  delete [] arr;
40 }
41 
43 {
44  delete [] arr;
45 }
46 
47 TESS_API void TESS_CALL TessDeleteBlockList(BLOCK_LIST* block_list)
48 {
49  TessBaseAPI::DeleteBlockList(block_list);
50 }
51 
53 {
54  return new TessTextRenderer(outputbase);
55 }
56 
58 {
59  return new TessHOcrRenderer(outputbase);
60 }
61 
63 {
64  return new TessHOcrRenderer(outputbase, font_info);
65 }
66 
67 TESS_API TessResultRenderer* TESS_CALL TessPDFRendererCreate(const char* outputbase, const char* datadir)
68 {
69  return new TessPDFRenderer(outputbase, datadir, false);
70 }
71 
72 TESS_API TessResultRenderer* TESS_CALL TessPDFRendererCreateTextonly(const char* outputbase, const char* datadir,
73  BOOL textonly)
74 {
75  return new TessPDFRenderer(outputbase, datadir, textonly);
76 }
77 
79 {
80  return new TessUnlvRenderer(outputbase);
81 }
82 
84 {
85  return new TessBoxTextRenderer(outputbase);
86 }
87 
89 {
90  delete renderer;
91 }
92 
94 {
95  renderer->insert(next);
96 }
97 
99 {
100  return renderer->next();
101 }
102 
104 {
105  return renderer->BeginDocument(title);
106 }
107 
109 {
110  return renderer->AddImage(api);
111 }
112 
114 {
115  return renderer->EndDocument();
116 }
117 
119 {
120  return renderer->file_extension();
121 }
122 
124 {
125  return renderer->title();
126 }
127 
129 {
130  return renderer->imagenum();
131 }
132 
134 {
135  return new TessBaseAPI;
136 }
137 
139 {
140  delete handle;
141 }
142 
144 {
145  return handle->getOpenCLDevice(device);
146 }
147 
148 TESS_API void TESS_CALL TessBaseAPISetInputName(TessBaseAPI* handle, const char* name)
149 {
150  handle->SetInputName(name);
151 }
152 
154 {
155  return handle->GetInputName();
156 }
157 
159 {
160  handle->SetInputImage(pix);
161 }
162 
164 {
165  return handle->GetInputImage();
166 }
167 
169 {
170  return handle->GetSourceYResolution();
171 }
172 
174 {
175  return handle->GetDatapath();
176 }
177 
179 {
180  handle->SetOutputName(name);
181 }
182 
183 TESS_API BOOL TESS_CALL TessBaseAPISetVariable(TessBaseAPI* handle, const char* name, const char* value)
184 {
185  return handle->SetVariable(name, value) ? TRUE : FALSE;
186 }
187 
188 TESS_API BOOL TESS_CALL TessBaseAPISetDebugVariable(TessBaseAPI* handle, const char* name, const char* value)
189 {
190  return handle->SetVariable(name, value) ? TRUE : FALSE;
191 }
192 
193 TESS_API BOOL TESS_CALL TessBaseAPIGetIntVariable(const TessBaseAPI* handle, const char* name, int* value)
194 {
195  return handle->GetIntVariable(name, value) ? TRUE : FALSE;
196 }
197 
198 TESS_API BOOL TESS_CALL TessBaseAPIGetBoolVariable(const TessBaseAPI* handle, const char* name, BOOL* value)
199 {
200  bool boolValue;
201  if (handle->GetBoolVariable(name, &boolValue))
202  {
203  *value = boolValue ? TRUE : FALSE;
204  return TRUE;
205  }
206  else
207  {
208  return FALSE;
209  }
210 }
211 
212 TESS_API BOOL TESS_CALL TessBaseAPIGetDoubleVariable(const TessBaseAPI* handle, const char* name, double* value)
213 {
214  return handle->GetDoubleVariable(name, value) ? TRUE : FALSE;
215 }
216 
217 TESS_API const char* TESS_CALL TessBaseAPIGetStringVariable(const TessBaseAPI* handle, const char* name)
218 {
219  return handle->GetStringVariable(name);
220 }
221 
223 {
224  handle->PrintVariables(fp);
225 }
226 
228 {
229  FILE* fp = fopen(filename, "w");
230  if (fp != NULL)
231  {
232  handle->PrintVariables(fp);
233  fclose(fp);
234  return TRUE;
235  }
236  return FALSE;
237 }
238 
240 {
241  return handle->GetVariableAsString(name, val) ? TRUE : FALSE;
242 }
243 
244 TESS_API int TESS_CALL TessBaseAPIInit4(TessBaseAPI* handle, const char* datapath, const char* language,
245  TessOcrEngineMode mode, char** configs, int configs_size,
246  char** vars_vec, char** vars_values, size_t vars_vec_size,
247  BOOL set_only_non_debug_params)
248 {
249  GenericVector<STRING> varNames;
250  GenericVector<STRING> varValues;
251  if (vars_vec != NULL && vars_values != NULL) {
252  for (size_t i = 0; i < vars_vec_size; i++) {
253  varNames.push_back(STRING(vars_vec[i]));
254  varValues.push_back(STRING(vars_values[i]));
255  }
256  }
257 
258  return handle->Init(datapath, language, mode, configs, configs_size, &varNames, &varValues, set_only_non_debug_params);
259 }
260 
261 
262 TESS_API int TESS_CALL TessBaseAPIInit1(TessBaseAPI* handle, const char* datapath, const char* language, TessOcrEngineMode oem,
263  char** configs, int configs_size)
264 {
265  return handle->Init(datapath, language, oem, configs, configs_size, NULL, NULL, false);
266 }
267 
268 TESS_API int TESS_CALL TessBaseAPIInit2(TessBaseAPI* handle, const char* datapath, const char* language, TessOcrEngineMode oem)
269 {
270  return handle->Init(datapath, language, oem);
271 }
272 
273 TESS_API int TESS_CALL TessBaseAPIInit3(TessBaseAPI* handle, const char* datapath, const char* language)
274 {
275  return handle->Init(datapath, language);
276 }
277 
279 {
280  return handle->GetInitLanguagesAsString();
281 }
282 
284 {
285  GenericVector<STRING> languages;
286  handle->GetLoadedLanguagesAsVector(&languages);
287  char** arr = new char*[languages.size() + 1];
288  for (int index = 0; index < languages.size(); ++index)
289  arr[index] = languages[index].strdup();
290  arr[languages.size()] = NULL;
291  return arr;
292 }
293 
295 {
296  GenericVector<STRING> languages;
297  handle->GetAvailableLanguagesAsVector(&languages);
298  char** arr = new char*[languages.size() + 1];
299  for (int index = 0; index < languages.size(); ++index)
300  arr[index] = languages[index].strdup();
301  arr[languages.size()] = NULL;
302  return arr;
303 }
304 
305 TESS_API int TESS_CALL TessBaseAPIInitLangMod(TessBaseAPI* handle, const char* datapath, const char* language)
306 {
307  return handle->InitLangMod(datapath, language);
308 }
309 
311 {
312  handle->InitForAnalysePage();
313 }
314 
316 {
317  handle->ReadConfigFile(filename);
318 }
319 
321 {
322  handle->ReadDebugConfigFile(filename);
323 }
324 
326 {
327  handle->SetPageSegMode(mode);
328 }
329 
331 {
332  return handle->GetPageSegMode();
333 }
334 
335 TESS_API char* TESS_CALL TessBaseAPIRect(TessBaseAPI* handle, const unsigned char* imagedata,
336  int bytes_per_pixel, int bytes_per_line,
337  int left, int top, int width, int height)
338 {
339  return handle->TesseractRect(imagedata, bytes_per_pixel, bytes_per_line, left, top, width, height);
340 }
341 
343 {
344  handle->ClearAdaptiveClassifier();
345 }
346 
347 TESS_API void TESS_CALL TessBaseAPISetImage(TessBaseAPI* handle, const unsigned char* imagedata, int width, int height,
348  int bytes_per_pixel, int bytes_per_line)
349 {
350  handle->SetImage(imagedata, width, height, bytes_per_pixel, bytes_per_line);
351 }
352 
353 TESS_API void TESS_CALL TessBaseAPISetImage2(TessBaseAPI* handle, struct Pix* pix)
354 {
355  return handle->SetImage(pix);
356 }
357 
359 {
360  handle->SetSourceResolution(ppi);
361 }
362 
363 TESS_API void TESS_CALL TessBaseAPISetRectangle(TessBaseAPI* handle, int left, int top, int width, int height)
364 {
365  handle->SetRectangle(left, top, width, height);
366 }
367 
368 TESS_API void TESS_CALL TessBaseAPISetThresholder(TessBaseAPI* handle, TessImageThresholder* thresholder)
369 {
370  handle->SetThresholder(thresholder);
371 }
372 
374 {
375  return handle->GetThresholdedImage();
376 }
377 
378 TESS_API struct Boxa* TESS_CALL TessBaseAPIGetRegions(TessBaseAPI* handle, struct Pixa** pixa)
379 {
380  return handle->GetRegions(pixa);
381 }
382 
383 TESS_API struct Boxa* TESS_CALL TessBaseAPIGetTextlines(TessBaseAPI* handle, struct Pixa** pixa, int** blockids)
384 {
385  return handle->GetTextlines(pixa, blockids);
386 }
387 
388 TESS_API struct Boxa* TESS_CALL TessBaseAPIGetTextlines1(TessBaseAPI* handle, const BOOL raw_image, const int raw_padding,
389  struct Pixa** pixa, int** blockids, int** paraids)
390 {
391  return handle->GetTextlines(raw_image, raw_padding, pixa, blockids, paraids);
392 }
393 
394 TESS_API struct Boxa* TESS_CALL TessBaseAPIGetStrips(TessBaseAPI* handle, struct Pixa** pixa, int** blockids)
395 {
396  return handle->GetStrips(pixa, blockids);
397 }
398 
399 TESS_API struct Boxa* TESS_CALL TessBaseAPIGetWords(TessBaseAPI* handle, struct Pixa** pixa)
400 {
401  return handle->GetWords(pixa);
402 }
403 
404 TESS_API struct Boxa* TESS_CALL TessBaseAPIGetConnectedComponents(TessBaseAPI* handle, struct Pixa** cc)
405 {
406  return handle->GetConnectedComponents(cc);
407 }
408 
409 TESS_API struct Boxa* TESS_CALL TessBaseAPIGetComponentImages(TessBaseAPI* handle, TessPageIteratorLevel level, BOOL text_only, struct Pixa** pixa, int** blockids)
410 {
411  return handle->GetComponentImages(level, text_only != FALSE, pixa, blockids);
412 }
413 
414 TESS_API struct Boxa*
416  const BOOL raw_image, const int raw_padding,
417  struct Pixa** pixa, int** blockids, int** paraids)
418 {
419  return handle->GetComponentImages(level, text_only != FALSE, raw_image, raw_padding, pixa, blockids, paraids);
420 }
421 
423 {
424  return handle->GetThresholdedImageScaleFactor();
425 }
426 
428 {
429  handle->DumpPGM(filename);
430 }
431 
433 {
434  return handle->AnalyseLayout();
435 }
436 
438 {
439  return handle->Recognize(monitor);
440 }
441 
443 {
444  return handle->RecognizeForChopTest(monitor);
445 }
446 
447 TESS_API BOOL TESS_CALL TessBaseAPIProcessPages(TessBaseAPI* handle, const char* filename, const char* retry_config,
448  int timeout_millisec, TessResultRenderer* renderer)
449 {
450  if (handle->ProcessPages(filename, retry_config, timeout_millisec, renderer))
451  return TRUE;
452  else
453  return FALSE;
454 }
455 
456 TESS_API BOOL TESS_CALL TessBaseAPIProcessPage(TessBaseAPI* handle, struct Pix* pix, int page_index, const char* filename,
457  const char* retry_config, int timeout_millisec, TessResultRenderer* renderer)
458 {
459  if (handle->ProcessPage(pix, page_index, filename, retry_config, timeout_millisec, renderer))
460  return TRUE;
461  else
462  return FALSE;
463 }
464 
466 {
467  return handle->GetIterator();
468 }
469 
471 {
472  return handle->GetMutableIterator();
473 }
474 
476 {
477  return handle->GetUTF8Text();
478 }
479 
480 TESS_API char* TESS_CALL TessBaseAPIGetHOCRText(TessBaseAPI* handle, int page_number)
481 {
482  return handle->GetHOCRText(NULL, page_number);
483 }
484 
485 TESS_API char* TESS_CALL TessBaseAPIGetBoxText(TessBaseAPI* handle, int page_number)
486 {
487  return handle->GetBoxText(page_number);
488 }
489 
491 {
492  return handle->GetUNLVText();
493 }
494 
496 {
497  return handle->MeanTextConf();
498 }
499 
501 {
502  return handle->AllWordConfidences();
503 }
504 
506 {
507  return handle->AdaptToWordStr(mode, wordstr) ? TRUE : FALSE;
508 }
509 
511 {
512  handle->Clear();
513 }
514 
516 {
517  handle->End();
518 }
519 
520 TESS_API int TESS_CALL TessBaseAPIIsValidWord(TessBaseAPI* handle, const char* word)
521 {
522  return handle->IsValidWord(word);
523 }
524 
525 TESS_API BOOL TESS_CALL TessBaseAPIGetTextDirection(TessBaseAPI* handle, int* out_offset, float* out_slope)
526 {
527  return handle->GetTextDirection(out_offset, out_slope) ? TRUE : FALSE;
528 }
529 
531 {
532  handle->SetDictFunc(f);
533 }
534 
536 {
537  handle->ClearPersistentCache();
538 }
539 
540 TESS_API void TESS_CALL TessBaseAPISetProbabilityInContextFunc(TessBaseAPI* handle, TessProbabilityInContextFunc f)
541 {
542  handle->SetProbabilityInContextFunc(f);
543 }
544 
546 {
547  return FALSE; // Unsafe ABI, return FALSE always
548 }
549 
551  int* orient_deg, float* orient_conf, const char** script_name, float* script_conf)
552 {
553  bool success;
554  success = handle->DetectOrientationScript(orient_deg, orient_conf, script_name, script_conf);
555  return (BOOL)success;
556 }
557 
558 
560  int* num_features, int* FeatureOutlineIndex)
561 {
562  handle->GetFeaturesForBlob(blob, int_features, num_features, FeatureOutlineIndex);
563 }
564 
565 TESS_API ROW* TESS_CALL TessFindRowForBox(BLOCK_LIST* blocks, int left, int top, int right, int bottom)
566 {
567  return TessBaseAPI::FindRowForBox(blocks, left, top, right, bottom);
568 }
569 
570 TESS_API void TESS_CALL TessBaseAPIRunAdaptiveClassifier(TessBaseAPI* handle, TBLOB* blob, int num_max_matches,
571  int* unichar_ids, float* ratings, int* num_matches_returned)
572 {
573  handle->RunAdaptiveClassifier(blob, num_max_matches, unichar_ids, ratings, num_matches_returned);
574 }
575 
576 TESS_API const char* TESS_CALL TessBaseAPIGetUnichar(TessBaseAPI* handle, int unichar_id)
577 {
578  return handle->GetUnichar(unichar_id);
579 }
580 
581 TESS_API const TessDawg* TESS_CALL TessBaseAPIGetDawg(const TessBaseAPI* handle, int i)
582 {
583  return handle->GetDawg(i);
584 }
585 
587 {
588  return handle->NumDawgs();
589 }
590 
591 TESS_API ROW* TESS_CALL TessMakeTessOCRRow(float baseline, float xheight, float descender, float ascender)
592 {
593  return TessBaseAPI::MakeTessOCRRow(baseline, xheight, descender, ascender);
594 }
595 
597 {
598  return TessBaseAPI::MakeTBLOB(pix);
599 }
600 
601 TESS_API void TESS_CALL TessNormalizeTBLOB(TBLOB* tblob, ROW* row, BOOL numeric_mode)
602 {
603  TessBaseAPI::NormalizeTBLOB(tblob, row, numeric_mode != FALSE);
604 }
605 
607 {
608  return handle->oem();
609 }
610 
611 TESS_API void TESS_CALL TessBaseAPIInitTruthCallback(TessBaseAPI* handle, TessTruthCallback* cb)
612 {
613  handle->InitTruthCallback(cb);
614 }
615 
616 #ifndef NO_CUBE_BUILD
617 TESS_API TessCubeRecoContext* TESS_CALL TessBaseAPIGetCubeRecoContext(const TessBaseAPI* handle)
618 {
619  return handle->GetCubeRecoContext();
620 }
621 #endif // NO_CUBE_BUILD
622 
624 {
625  handle->set_min_orientation_margin(margin);
626 }
627 
628 TESS_API void TESS_CALL TessBaseGetBlockTextOrientations(TessBaseAPI* handle, int** block_orientation, bool** vertical_writing)
629 {
630  handle->GetBlockTextOrientations(block_orientation, vertical_writing);
631 }
632 
634 {
635  return handle->FindLinesCreateBlockList();
636 }
637 
639 {
640  delete handle;
641 }
642 
644 {
645  return new TessPageIterator(*handle);
646 }
647 
649 {
650  handle->Begin();
651 }
652 
654 {
655  return handle->Next(level) ? TRUE : FALSE;
656 }
657 
659 {
660  return handle->IsAtBeginningOf(level) ? TRUE : FALSE;
661 }
662 
664  TessPageIteratorLevel element)
665 {
666  return handle->IsAtFinalElement(level, element) ? TRUE : FALSE;
667 }
668 
670  int* left, int* top, int* right, int* bottom)
671 {
672  return handle->BoundingBox(level, left, top, right, bottom) ? TRUE : FALSE;
673 }
674 
676 {
677  return handle->BlockType();
678 }
679 
681 {
682  return handle->GetBinaryImage(level);
683 }
684 
686  struct Pix* original_image, int* left, int* top)
687 {
688  return handle->GetImage(level, padding, original_image, left, top);
689 }
690 
692  int* x1, int* y1, int* x2, int* y2)
693 {
694  return handle->Baseline(level, x1, y1, x2, y2) ? TRUE : FALSE;
695 }
696 
698  TessWritingDirection* writing_direction, TessTextlineOrder* textline_order,
699  float* deskew_angle)
700 {
701  handle->Orientation(orientation, writing_direction, textline_order, deskew_angle);
702 }
703 
705  BOOL *is_list_item, BOOL *is_crown, int *first_line_indent)
706 {
707  bool bool_is_list_item, bool_is_crown;
708  handle->ParagraphInfo(justification, &bool_is_list_item, &bool_is_crown, first_line_indent);
709  if (is_list_item)
710  *is_list_item = bool_is_list_item ? TRUE : FALSE;
711  if (is_crown)
712  *is_crown = bool_is_crown ? TRUE : FALSE;
713 }
714 
715 
717 {
718  delete handle;
719 }
720 
722 {
723  return new TessResultIterator(*handle);
724 }
725 
727 {
728  return handle;
729 }
730 
732 {
733  return handle;
734 }
735 
737 {
738  return new TessChoiceIterator(*handle);
739 }
740 
742 {
743  return handle->Next(level);
744 }
745 
747 {
748  return handle->GetUTF8Text(level);
749 }
750 
752 {
753  return handle->Confidence(level);
754 }
755 
757 {
758  return handle->WordRecognitionLanguage();
759 }
760 
761 TESS_API const char* TESS_CALL TessResultIteratorWordFontAttributes(const TessResultIterator* handle, BOOL* is_bold, BOOL* is_italic,
762  BOOL* is_underlined, BOOL* is_monospace, BOOL* is_serif,
763  BOOL* is_smallcaps, int* pointsize, int* font_id)
764 {
765  bool bool_is_bold, bool_is_italic, bool_is_underlined, bool_is_monospace, bool_is_serif, bool_is_smallcaps;
766  const char* ret = handle->WordFontAttributes(&bool_is_bold, &bool_is_italic, &bool_is_underlined, &bool_is_monospace, &bool_is_serif,
767  &bool_is_smallcaps, pointsize, font_id);
768  if (is_bold)
769  *is_bold = bool_is_bold ? TRUE : FALSE;
770  if (is_italic)
771  *is_italic = bool_is_italic ? TRUE : FALSE;
772  if (is_underlined)
773  *is_underlined = bool_is_underlined ? TRUE : FALSE;
774  if (is_monospace)
775  *is_monospace = bool_is_monospace ? TRUE : FALSE;
776  if (is_serif)
777  *is_serif = bool_is_serif ? TRUE : FALSE;
778  if (is_smallcaps)
779  *is_smallcaps = bool_is_smallcaps ? TRUE : FALSE;
780  return ret;
781 }
782 
784 {
785  return handle->WordIsFromDictionary() ? TRUE : FALSE;
786 }
787 
789 {
790  return handle->WordIsNumeric() ? TRUE : FALSE;
791 }
792 
794 {
795  return handle->SymbolIsSuperscript() ? TRUE : FALSE;
796 }
797 
799 {
800  return handle->SymbolIsSubscript() ? TRUE : FALSE;
801 }
802 
804 {
805  return handle->SymbolIsDropcap() ? TRUE : FALSE;
806 }
807 
809 {
810  delete handle;
811 }
812 
814 {
815  return handle->Next();
816 }
817 
819 {
820  return handle->GetUTF8Text();
821 }
822 
824 {
825  return handle->Confidence();
826 }
TESS_API struct Pix *TESS_CALL TessBaseAPIGetThresholdedImage(TessBaseAPI *handle)
Definition: capi.cpp:373
TESS_API void TESS_CALL TessBaseAPISetInputName(TessBaseAPI *handle, const char *name)
Definition: capi.cpp:148
#define TESS_CALL
Definition: capi.h:39
struct TessChoiceIterator TessChoiceIterator
Definition: capi.h:90
TESS_API int TESS_CALL TessBaseAPIIsValidWord(TessBaseAPI *handle, const char *word)
Definition: capi.cpp:520
TESS_API TessPageIterator *TESS_CALL TessResultIteratorGetPageIterator(TessResultIterator *handle)
Definition: capi.cpp:726
TESS_API void TESS_CALL TessChoiceIteratorDelete(TessChoiceIterator *handle)
Definition: capi.cpp:808
TESS_API int TESS_CALL TessResultRendererImageNum(TessResultRenderer *renderer)
Definition: capi.cpp:128
TessWritingDirection
Definition: capi.h:101
TESS_API void TESS_CALL TessBaseAPISetMinOrientationMargin(TessBaseAPI *handle, double margin)
Definition: capi.cpp:623
TESS_API size_t TESS_CALL TessBaseAPIGetOpenCLDevice(TessBaseAPI *handle, void **device)
Definition: capi.cpp:143
TESS_API void TESS_CALL TessBaseAPISetThresholder(TessBaseAPI *handle, TessImageThresholder *thresholder)
Definition: capi.cpp:368
TESS_API void TESS_CALL TessPageIteratorBegin(TessPageIterator *handle)
Definition: capi.cpp:648
TESS_API BOOL TESS_CALL TessBaseAPIDetectOrientationScript(TessBaseAPI *handle, int *orient_deg, float *orient_conf, const char **script_name, float *script_conf)
Definition: capi.cpp:550
TESS_API char **TESS_CALL TessBaseAPIGetLoadedLanguagesAsVector(const TessBaseAPI *handle)
Definition: capi.cpp:283
TESS_API int TESS_CALL TessBaseAPIGetThresholdedImageScaleFactor(const TessBaseAPI *handle)
Definition: capi.cpp:422
TESS_API void TESS_CALL TessDeleteText(char *text)
Definition: capi.cpp:30
TESS_API BOOL TESS_CALL TessPageIteratorBaseline(const TessPageIterator *handle, TessPageIteratorLevel level, int *x1, int *y1, int *x2, int *y2)
Definition: capi.cpp:691
TessParagraphJustification
Definition: capi.h:100
struct TessUnlvRenderer TessUnlvRenderer
Definition: capi.h:84
TESS_API struct Boxa *TESS_CALL TessBaseAPIGetRegions(TessBaseAPI *handle, struct Pixa **pixa)
Definition: capi.cpp:378
#define TRUE
Definition: capi.h:45
TessPageSegMode
Definition: capi.h:92
TESS_API const char *TESS_CALL TessBaseAPIGetUnichar(TessBaseAPI *handle, int unichar_id)
Definition: capi.cpp:576
struct TessPDFRenderer TessPDFRenderer
Definition: capi.h:83
TESS_API void TESS_CALL TessBaseAPIClearPersistentCache(TessBaseAPI *handle)
Definition: capi.cpp:535
TESS_API BOOL TESS_CALL TessBaseAPIPrintVariablesToFile(const TessBaseAPI *handle, const char *filename)
Definition: capi.cpp:227
TESS_API const char *TESS_CALL TessResultIteratorWordFontAttributes(const TessResultIterator *handle, BOOL *is_bold, BOOL *is_italic, BOOL *is_underlined, BOOL *is_monospace, BOOL *is_serif, BOOL *is_smallcaps, int *pointsize, int *font_id)
Definition: capi.cpp:761
TESS_API void TESS_CALL TessBaseAPISetDictFunc(TessBaseAPI *handle, TessDictFunc f)
Definition: capi.cpp:530
TESS_API struct Boxa *TESS_CALL TessBaseAPIGetComponentImages1(TessBaseAPI *handle, const TessPageIteratorLevel level, const BOOL text_only, const BOOL raw_image, const int raw_padding, struct Pixa **pixa, int **blockids, int **paraids)
Definition: capi.cpp:415
struct TessBaseAPI TessBaseAPI
Definition: capi.h:86
TESS_API const char *TESS_CALL TessBaseAPIGetInputName(TessBaseAPI *handle)
Definition: capi.cpp:153
TESS_API BOOL TESS_CALL TessBaseAPIGetVariableAsString(TessBaseAPI *handle, const char *name, STRING *val)
Definition: capi.cpp:239
TESS_API void TESS_CALL TessBaseAPIClear(TessBaseAPI *handle)
Definition: capi.cpp:510
#define TESS_API
Definition: platform.h:81
TESS_API char *TESS_CALL TessBaseAPIGetHOCRText(TessBaseAPI *handle, int page_number)
Definition: capi.cpp:480
TESS_API BOOL TESS_CALL TessChoiceIteratorNext(TessChoiceIterator *handle)
Definition: capi.cpp:813
struct TessTextRenderer TessTextRenderer
Definition: capi.h:81
TessPolyBlockType
Definition: capi.h:96
TESS_API char *TESS_CALL TessBaseAPIGetUTF8Text(TessBaseAPI *handle)
Definition: capi.cpp:475
TESS_API BOOL TESS_CALL TessBaseAPIGetBoolVariable(const TessBaseAPI *handle, const char *name, BOOL *value)
Definition: capi.cpp:198
TESS_API void TESS_CALL TessBaseAPISetSourceResolution(TessBaseAPI *handle, int ppi)
Definition: capi.cpp:358
TESS_API const char *TESS_CALL TessChoiceIteratorGetUTF8Text(const TessChoiceIterator *handle)
Definition: capi.cpp:818
TESS_API void TESS_CALL TessDeleteTextArray(char **arr)
Definition: capi.cpp:35
TESS_API struct Boxa *TESS_CALL TessBaseAPIGetComponentImages(TessBaseAPI *handle, TessPageIteratorLevel level, BOOL text_only, struct Pixa **pixa, int **blockids)
Definition: capi.cpp:409
TESS_API BOOL TESS_CALL TessPageIteratorIsAtFinalElement(const TessPageIterator *handle, TessPageIteratorLevel level, TessPageIteratorLevel element)
Definition: capi.cpp:663
TESS_API void TESS_CALL TessBaseAPIRunAdaptiveClassifier(TessBaseAPI *handle, TBLOB *blob, int num_max_matches, int *unichar_ids, float *ratings, int *num_matches_returned)
Definition: capi.cpp:570
TESS_API float TESS_CALL TessChoiceIteratorConfidence(const TessChoiceIterator *handle)
Definition: capi.cpp:823
TESS_API void TESS_CALL TessBaseAPIDumpPGM(TessBaseAPI *handle, const char *filename)
Definition: capi.cpp:427
TESS_API const TessDawg *TESS_CALL TessBaseAPIGetDawg(const TessBaseAPI *handle, int i)
Definition: capi.cpp:581
TESS_API BOOL TESS_CALL TessBaseAPIAdaptToWordStr(TessBaseAPI *handle, TessPageSegMode mode, const char *wordstr)
Definition: capi.cpp:505
TESS_API void TESS_CALL TessBaseAPISetRectangle(TessBaseAPI *handle, int left, int top, int width, int height)
Definition: capi.cpp:363
TESS_API char *TESS_CALL TessBaseAPIGetBoxText(TessBaseAPI *handle, int page_number)
Definition: capi.cpp:485
TESS_API BOOL TESS_CALL TessBaseAPISetVariable(TessBaseAPI *handle, const char *name, const char *value)
Definition: capi.cpp:183
TESS_API BOOL TESS_CALL TessBaseAPIDetectOS(TessBaseAPI *handle, OSResults *results)
Definition: capi.cpp:545
TESS_API TessResultRenderer *TESS_CALL TessUnlvRendererCreate(const char *outputbase)
Definition: capi.cpp:78
TessPageIteratorLevel
Definition: capi.h:95
TESS_API BOOL TESS_CALL TessBaseAPISetDebugVariable(TessBaseAPI *handle, const char *name, const char *value)
Definition: capi.cpp:188
TESS_API char *TESS_CALL TessResultIteratorGetUTF8Text(const TessResultIterator *handle, TessPageIteratorLevel level)
Definition: capi.cpp:746
TESS_API TessPolyBlockType TESS_CALL TessPageIteratorBlockType(const TessPageIterator *handle)
Definition: capi.cpp:675
TESS_API void TESS_CALL TessNormalizeTBLOB(TBLOB *tblob, ROW *row, BOOL numeric_mode)
Definition: capi.cpp:601
TESS_API Pix *TESS_CALL TessBaseAPIGetInputImage(TessBaseAPI *handle)
Definition: capi.cpp:163
TESS_API void TESS_CALL TessPageIteratorDelete(TessPageIterator *handle)
Definition: capi.cpp:638
#define BOOL
Definition: capi.h:44
TESS_API TessResultRenderer *TESS_CALL TessBoxTextRendererCreate(const char *outputbase)
Definition: capi.cpp:83
TESS_API TessResultRenderer *TESS_CALL TessTextRendererCreate(const char *outputbase)
Definition: capi.cpp:52
TESS_API TessChoiceIterator *TESS_CALL TessResultIteratorGetChoiceIterator(const TessResultIterator *handle)
Definition: capi.cpp:736
TESS_API void TESS_CALL TessBaseAPIInitForAnalysePage(TessBaseAPI *handle)
Definition: capi.cpp:310
TESS_API int TESS_CALL TessBaseAPIInit4(TessBaseAPI *handle, const char *datapath, const char *language, TessOcrEngineMode mode, char **configs, int configs_size, char **vars_vec, char **vars_values, size_t vars_vec_size, BOOL set_only_non_debug_params)
Definition: capi.cpp:244
TESS_API BOOL TESS_CALL TessPageIteratorIsAtBeginningOf(const TessPageIterator *handle, TessPageIteratorLevel level)
Definition: capi.cpp:658
TESS_API void TESS_CALL TessBaseAPISetImage2(TessBaseAPI *handle, struct Pix *pix)
Definition: capi.cpp:353
TESS_API int TESS_CALL TessBaseAPIInit3(TessBaseAPI *handle, const char *datapath, const char *language)
Definition: capi.cpp:273
TESS_API void TESS_CALL TessBaseAPISetOutputName(TessBaseAPI *handle, const char *name)
Definition: capi.cpp:178
TESS_API BOOL TESS_CALL TessPageIteratorBoundingBox(const TessPageIterator *handle, TessPageIteratorLevel level, int *left, int *top, int *right, int *bottom)
Definition: capi.cpp:669
TESS_API TessOcrEngineMode TESS_CALL TessBaseAPIOem(const TessBaseAPI *handle)
Definition: capi.cpp:606
TESS_API void TESS_CALL TessBaseAPIReadConfigFile(TessBaseAPI *handle, const char *filename)
Definition: capi.cpp:315
int push_back(T object)
TESS_API TessResultRenderer *TESS_CALL TessPDFRendererCreate(const char *outputbase, const char *datadir)
Definition: capi.cpp:67
TESS_API struct Boxa *TESS_CALL TessBaseAPIGetConnectedComponents(TessBaseAPI *handle, struct Pixa **cc)
Definition: capi.cpp:404
TessOrientation
Definition: capi.h:99
TESS_API TBLOB *TESS_CALL TessMakeTBLOB(struct Pix *pix)
Definition: capi.cpp:596
TessOcrEngineMode
Definition: capi.h:91
TESS_API struct Pix *TESS_CALL TessPageIteratorGetBinaryImage(const TessPageIterator *handle, TessPageIteratorLevel level)
Definition: capi.cpp:680
TESS_API BOOL TESS_CALL TessResultRendererBeginDocument(TessResultRenderer *renderer, const char *title)
Definition: capi.cpp:103
TESS_API void TESS_CALL TessBaseAPISetImage(TessBaseAPI *handle, const unsigned char *imagedata, int width, int height, int bytes_per_pixel, int bytes_per_line)
Definition: capi.cpp:347
struct TessHOcrRenderer TessHOcrRenderer
Definition: capi.h:82
TESS_API void TESS_CALL TessBaseAPISetProbabilityInContextFunc(TessBaseAPI *handle, TessProbabilityInContextFunc f)
Definition: capi.cpp:540
TESS_API struct Boxa *TESS_CALL TessBaseAPIGetWords(TessBaseAPI *handle, struct Pixa **pixa)
Definition: capi.cpp:399
TESS_API TessResultRenderer *TESS_CALL TessResultRendererNext(TessResultRenderer *renderer)
Definition: capi.cpp:98
TESS_API void TESS_CALL TessDeleteBlockList(BLOCK_LIST *block_list)
Definition: capi.cpp:47
TESS_API const char *TESS_CALL TessResultIteratorWordRecognitionLanguage(const TessResultIterator *handle)
Definition: capi.cpp:756
#define FALSE
Definition: capi.h:46
TESS_API int TESS_CALL TessBaseAPIGetSourceYResolution(TessBaseAPI *handle)
Definition: capi.cpp:168
TESS_API void TESS_CALL TessBaseAPIEnd(TessBaseAPI *handle)
Definition: capi.cpp:515
TESS_API struct Boxa *TESS_CALL TessBaseAPIGetTextlines1(TessBaseAPI *handle, const BOOL raw_image, const int raw_padding, struct Pixa **pixa, int **blockids, int **paraids)
Definition: capi.cpp:388
TESS_API BOOL TESS_CALL TessBaseAPIGetIntVariable(const TessBaseAPI *handle, const char *name, int *value)
Definition: capi.cpp:193
CMD_EVENTS mode
Definition: pgedit.cpp:116
TESS_API BOOL TESS_CALL TessResultIteratorSymbolIsSuperscript(const TessResultIterator *handle)
Definition: capi.cpp:793
TESS_API int TESS_CALL TessBaseAPIInitLangMod(TessBaseAPI *handle, const char *datapath, const char *language)
Definition: capi.cpp:305
TESS_API ROW *TESS_CALL TessFindRowForBox(BLOCK_LIST *blocks, int left, int top, int right, int bottom)
Definition: capi.cpp:565
TESS_API BOOL TESS_CALL TessBaseAPIProcessPages(TessBaseAPI *handle, const char *filename, const char *retry_config, int timeout_millisec, TessResultRenderer *renderer)
Definition: capi.cpp:447
TESS_API void TESS_CALL TessBaseAPIPrintVariables(const TessBaseAPI *handle, FILE *fp)
Definition: capi.cpp:222
TESS_API const char *TESS_CALL TessBaseAPIGetDatapath(TessBaseAPI *handle)
Definition: capi.cpp:173
TESS_API int TESS_CALL TessBaseAPIInit2(TessBaseAPI *handle, const char *datapath, const char *language, TessOcrEngineMode oem)
Definition: capi.cpp:268
TESS_API BOOL TESS_CALL TessResultRendererAddImage(TessResultRenderer *renderer, TessBaseAPI *api)
Definition: capi.cpp:108
TESS_API void TESS_CALL TessBaseGetBlockTextOrientations(TessBaseAPI *handle, int **block_orientation, bool **vertical_writing)
Definition: capi.cpp:628
TESS_API void TESS_CALL TessBaseAPIInitTruthCallback(TessBaseAPI *handle, TessTruthCallback *cb)
Definition: capi.cpp:611
TESS_API void TESS_CALL TessPageIteratorParagraphInfo(TessPageIterator *handle, TessParagraphJustification *justification, BOOL *is_list_item, BOOL *is_crown, int *first_line_indent)
Definition: capi.cpp:704
TESS_API BOOL TESS_CALL TessPageIteratorNext(TessPageIterator *handle, TessPageIteratorLevel level)
Definition: capi.cpp:653
TESS_API int *TESS_CALL TessBaseAPIAllWordConfidences(TessBaseAPI *handle)
Definition: capi.cpp:500
TESS_API struct Boxa *TESS_CALL TessBaseAPIGetStrips(TessBaseAPI *handle, struct Pixa **pixa, int **blockids)
Definition: capi.cpp:394
TESS_API const char *TESS_CALL TessResultRendererTitle(TessResultRenderer *renderer)
Definition: capi.cpp:123
TESS_API BOOL TESS_CALL TessResultRendererEndDocument(TessResultRenderer *renderer)
Definition: capi.cpp:113
TESS_API void TESS_CALL TessBaseAPISetPageSegMode(TessBaseAPI *handle, TessPageSegMode mode)
Definition: capi.cpp:325
Definition: ocrrow.h:32
TESS_API char *TESS_CALL TessBaseAPIGetUNLVText(TessBaseAPI *handle)
Definition: capi.cpp:490
Definition: strngs.h:44
TESS_API struct Pix *TESS_CALL TessPageIteratorGetImage(const TessPageIterator *handle, TessPageIteratorLevel level, int padding, struct Pix *original_image, int *left, int *top)
Definition: capi.cpp:685
int size() const
Definition: genericvector.h:72
TESS_API TessResultIterator *TESS_CALL TessResultIteratorCopy(const TessResultIterator *handle)
Definition: capi.cpp:721
TESS_API BOOL TESS_CALL TessResultIteratorSymbolIsSubscript(const TessResultIterator *handle)
Definition: capi.cpp:798
TESS_API const TessPageIterator *TESS_CALL TessResultIteratorGetPageIteratorConst(const TessResultIterator *handle)
Definition: capi.cpp:731
TessTextlineOrder
Definition: capi.h:102
Definition: blobs.h:261
struct TessResultIterator TessResultIterator
Definition: capi.h:88
TESS_API void TESS_CALL TessBaseAPIGetFeaturesForBlob(TessBaseAPI *handle, TBLOB *blob, INT_FEATURE_STRUCT *int_features, int *num_features, int *FeatureOutlineIndex)
Definition: capi.cpp:559
TESS_API void TESS_CALL TessResultRendererInsert(TessResultRenderer *renderer, TessResultRenderer *next)
Definition: capi.cpp:93
TESS_API ROW *TESS_CALL TessMakeTessOCRRow(float baseline, float xheight, float descender, float ascender)
Definition: capi.cpp:591
TESS_API char *TESS_CALL TessBaseAPIRect(TessBaseAPI *handle, const unsigned char *imagedata, int bytes_per_pixel, int bytes_per_line, int left, int top, int width, int height)
Definition: capi.cpp:335
TESS_API const char *TESS_CALL TessResultRendererExtention(TessResultRenderer *renderer)
Definition: capi.cpp:118
TESS_API const char *TESS_CALL TessVersion()
Definition: capi.cpp:25
TESS_API TessResultRenderer *TESS_CALL TessHOcrRendererCreate(const char *outputbase)
Definition: capi.cpp:57
struct TessResultRenderer TessResultRenderer
Definition: capi.h:80
TESS_API TessMutableIterator *TESS_CALL TessBaseAPIGetMutableIterator(TessBaseAPI *handle)
Definition: capi.cpp:470
struct TessMutableIterator TessMutableIterator
Definition: capi.h:89
TESS_API void TESS_CALL TessDeleteResultRenderer(TessResultRenderer *renderer)
Definition: capi.cpp:88
TESS_API BOOL TESS_CALL TessBaseAPIProcessPage(TessBaseAPI *handle, struct Pix *pix, int page_index, const char *filename, const char *retry_config, int timeout_millisec, TessResultRenderer *renderer)
Definition: capi.cpp:456
TESS_API void TESS_CALL TessBaseAPIDelete(TessBaseAPI *handle)
Definition: capi.cpp:138
TESS_API void TESS_CALL TessBaseAPIReadDebugConfigFile(TessBaseAPI *handle, const char *filename)
Definition: capi.cpp:320
TESS_API void TESS_CALL TessDeleteIntArray(int *arr)
Definition: capi.cpp:42
TESS_API BOOL TESS_CALL TessResultIteratorWordIsFromDictionary(const TessResultIterator *handle)
Definition: capi.cpp:783
TESS_API void TESS_CALL TessBaseAPISetInputImage(TessBaseAPI *handle, Pix *pix)
Definition: capi.cpp:158
TESS_API TessPageIterator *TESS_CALL TessBaseAPIAnalyseLayout(TessBaseAPI *handle)
Definition: capi.cpp:432
TESS_API BOOL TESS_CALL TessBaseAPIGetTextDirection(TessBaseAPI *handle, int *out_offset, float *out_slope)
Definition: capi.cpp:525
TESS_API int TESS_CALL TessBaseAPIInit1(TessBaseAPI *handle, const char *datapath, const char *language, TessOcrEngineMode oem, char **configs, int configs_size)
Definition: capi.cpp:262
TESS_API TessResultRenderer *TESS_CALL TessPDFRendererCreateTextonly(const char *outputbase, const char *datadir, BOOL textonly)
Definition: capi.cpp:72
TESS_API float TESS_CALL TessResultIteratorConfidence(const TessResultIterator *handle, TessPageIteratorLevel level)
Definition: capi.cpp:751
TESS_API const char *TESS_CALL TessBaseAPIGetInitLanguagesAsString(const TessBaseAPI *handle)
Definition: capi.cpp:278
TESS_API TessPageIterator *TESS_CALL TessPageIteratorCopy(const TessPageIterator *handle)
Definition: capi.cpp:643
TESS_API int TESS_CALL TessBaseAPINumDawgs(const TessBaseAPI *handle)
Definition: capi.cpp:586
TESS_API int TESS_CALL TessBaseAPIRecognize(TessBaseAPI *handle, ETEXT_DESC *monitor)
Definition: capi.cpp:437
TESS_API BOOL TESS_CALL TessBaseAPIGetDoubleVariable(const TessBaseAPI *handle, const char *name, double *value)
Definition: capi.cpp:212
TESS_API TessBaseAPI *TESS_CALL TessBaseAPICreate()
Definition: capi.cpp:133
TESS_API BLOCK_LIST *TESS_CALL TessBaseAPIFindLinesCreateBlockList(TessBaseAPI *handle)
Definition: capi.cpp:633
struct TessBoxTextRenderer TessBoxTextRenderer
Definition: capi.h:85
TESS_API BOOL TESS_CALL TessResultIteratorWordIsNumeric(const TessResultIterator *handle)
Definition: capi.cpp:788
TESS_API void TESS_CALL TessPageIteratorOrientation(TessPageIterator *handle, TessOrientation *orientation, TessWritingDirection *writing_direction, TessTextlineOrder *textline_order, float *deskew_angle)
Definition: capi.cpp:697
TESS_API TessResultIterator *TESS_CALL TessBaseAPIGetIterator(TessBaseAPI *handle)
Definition: capi.cpp:465
TESS_API int TESS_CALL TessBaseAPIMeanTextConf(TessBaseAPI *handle)
Definition: capi.cpp:495
struct TessPageIterator TessPageIterator
Definition: capi.h:87
TESS_API TessResultRenderer *TESS_CALL TessHOcrRendererCreate2(const char *outputbase, BOOL font_info)
Definition: capi.cpp:62
TESS_API TessPageSegMode TESS_CALL TessBaseAPIGetPageSegMode(const TessBaseAPI *handle)
Definition: capi.cpp:330
TESS_API void TESS_CALL TessBaseAPIClearAdaptiveClassifier(TessBaseAPI *handle)
Definition: capi.cpp:342
TESS_API BOOL TESS_CALL TessResultIteratorSymbolIsDropcap(const TessResultIterator *handle)
Definition: capi.cpp:803
TESS_API char **TESS_CALL TessBaseAPIGetAvailableLanguagesAsVector(const TessBaseAPI *handle)
Definition: capi.cpp:294
TESS_API BOOL TESS_CALL TessResultIteratorNext(TessResultIterator *handle, TessPageIteratorLevel level)
Definition: capi.cpp:741
TESS_API void TESS_CALL TessResultIteratorDelete(TessResultIterator *handle)
Definition: capi.cpp:716
TESS_API const char *TESS_CALL TessBaseAPIGetStringVariable(const TessBaseAPI *handle, const char *name)
Definition: capi.cpp:217
TESS_API struct Boxa *TESS_CALL TessBaseAPIGetTextlines(TessBaseAPI *handle, struct Pixa **pixa, int **blockids)
Definition: capi.cpp:383
TESS_API int TESS_CALL TessBaseAPIRecognizeForChopTest(TessBaseAPI *handle, ETEXT_DESC *monitor)
Definition: capi.cpp:442
TESS_API TessCubeRecoContext *TESS_CALL TessBaseAPIGetCubeRecoContext(const TessBaseAPI *handle)
Definition: capi.cpp:617