1 #ifndef TESS_CAPI_INCLUDE_BASEAPI
2 # define TESS_CAPI_INCLUDE_BASEAPI
8 return TessBaseAPI::Version();
18 for (
char** pos = arr; *pos !=
NULL; ++pos)
30 TessBaseAPI::DeleteBlockList(block_list);
45 handle->SetInputName(name);
50 handle->SetOutputName(name);
55 return handle->SetVariable(name, value) ?
TRUE :
FALSE;
60 return handle->SetVariable(name, value) ?
TRUE :
FALSE;
65 return handle->GetIntVariable(name, value) ?
TRUE :
FALSE;
71 if (handle->GetBoolVariable(name, &boolValue))
84 return handle->GetDoubleVariable(name, value) ?
TRUE :
FALSE;
89 return handle->GetStringVariable(name);
94 handle->PrintVariables(fp);
99 FILE* fp = fopen(filename,
"w");
102 handle->PrintVariables(fp);
111 return handle->GetVariableAsString(name, val) ?
TRUE :
FALSE;
115 char** configs,
int configs_size)
117 return handle->Init(datapath, language, oem, configs, configs_size,
NULL,
NULL,
false);
122 return handle->Init(datapath, language, oem);
127 return handle->Init(datapath, language);
132 return handle->GetInitLanguagesAsString();
138 handle->GetLoadedLanguagesAsVector(&languages);
139 char** arr =
new char*[languages.
size() + 1];
140 for (
int index = 0; index < languages.
size(); ++index)
141 arr[index] = languages[index].strdup();
149 handle->GetAvailableLanguagesAsVector(&languages);
150 char** arr =
new char*[languages.
size() + 1];
151 for (
int index = 0; index < languages.
size(); ++index)
152 arr[index] = languages[index].strdup();
159 return handle->InitLangMod(datapath, language);
164 handle->InitForAnalysePage();
169 handle->ReadConfigFile(filename);
174 handle->ReadDebugConfigFile(filename);
179 handle->SetPageSegMode(mode);
184 return handle->GetPageSegMode();
188 int bytes_per_pixel,
int bytes_per_line,
189 int left,
int top,
int width,
int height)
191 return handle->TesseractRect(imagedata, bytes_per_pixel, bytes_per_line, left, top, width, height);
196 handle->ClearAdaptiveClassifier();
200 int bytes_per_pixel,
int bytes_per_line)
202 handle->SetImage(imagedata, width, height, bytes_per_pixel, bytes_per_line);
207 return handle->SetImage(pix);
212 handle->SetSourceResolution(ppi);
217 handle->SetRectangle(left, top, width, height);
222 handle->SetThresholder(thresholder);
227 return handle->GetThresholdedImage();
232 return handle->GetRegions(pixa);
237 return handle->GetTextlines(pixa, blockids);
242 return handle->GetStrips(pixa, blockids);
247 return handle->GetWords(pixa);
252 return handle->GetConnectedComponents(cc);
257 return handle->GetComponentImages(level, text_only !=
FALSE, pixa, blockids);
262 return handle->GetThresholdedImageScaleFactor();
267 handle->DumpPGM(filename);
272 return handle->AnalyseLayout();
277 return handle->Recognize(monitor);
282 return handle->RecognizeForChopTest(monitor);
286 int timeout_millisec)
289 if (handle->ProcessPages(filename, retry_config, timeout_millisec, &text_out))
296 const char* retry_config,
int timeout_millisec)
299 if (handle->ProcessPage(pix, page_index, filename, retry_config, timeout_millisec, &text_out))
307 return handle->GetIterator();
312 return handle->GetMutableIterator();
317 return handle->GetUTF8Text();
322 return handle->GetHOCRText(page_number);
327 return handle->GetBoxText(page_number);
332 return handle->GetUNLVText();
337 return handle->MeanTextConf();
342 return handle->AllWordConfidences();
347 return handle->AdaptToWordStr(mode, wordstr) ?
TRUE :
FALSE;
362 return handle->IsValidWord(word);
367 return handle->GetTextDirection(out_offset, out_slope) ?
TRUE :
FALSE;
372 handle->SetDictFunc(f);
377 handle->SetProbabilityInContextFunc(f);
382 return handle->DetectOS(results) ?
TRUE :
FALSE;
386 int* num_features,
int* FeatureOutlineIndex)
388 handle->GetFeaturesForBlob(blob, *denorm, int_features, num_features, FeatureOutlineIndex);
393 return TessBaseAPI::FindRowForBox(blocks, left, top, right, bottom);
397 int* unichar_ids,
float* ratings,
int* num_matches_returned)
399 handle->RunAdaptiveClassifier(blob, *denorm, num_max_matches, unichar_ids, ratings, num_matches_returned);
404 return handle->GetUnichar(unichar_id);
409 return handle->GetDawg(i);
414 return handle->NumDawgs();
419 return TessBaseAPI::MakeTessOCRRow(baseline, xheight, descender, ascender);
424 return TessBaseAPI::MakeTBLOB(pix);
429 TessBaseAPI::NormalizeTBLOB(tblob, row, numeric_mode !=
FALSE, denorm);
434 return handle->oem();
439 handle->InitTruthCallback(cb);
444 return handle->GetCubeRecoContext();
449 handle->set_min_orientation_margin(margin);
454 handle->GetBlockTextOrientations(block_orientation, vertical_writing);
459 return handle->FindLinesCreateBlockList();
479 return handle->Next(level) ?
TRUE :
FALSE;
484 return handle->IsAtBeginningOf(level) ?
TRUE :
FALSE;
490 return handle->IsAtFinalElement(level, element) ?
TRUE :
FALSE;
494 int* left,
int* top,
int* right,
int* bottom)
496 return handle->BoundingBox(level, left, top, right, bottom) ?
TRUE :
FALSE;
501 return handle->BlockType();
506 return handle->GetBinaryImage(level);
512 return handle->GetImage(level, padding, left, top);
516 int* x1,
int* y1,
int* x2,
int* y2)
518 return handle->Baseline(level, x1, y1, x2, y2) ?
TRUE :
FALSE;
525 handle->Orientation(orientation, writing_direction, textline_order, deskew_angle);
550 return handle->GetUTF8Text(level);
555 return handle->Confidence(level);
559 BOOL* is_underlined,
BOOL* is_monospace,
BOOL* is_serif,
560 BOOL* is_smallcaps,
int* pointsize,
int* font_id)
562 bool bool_is_bold, bool_is_italic, bool_is_underlined, bool_is_monospace, bool_is_serif, bool_is_smallcaps;
563 const char* ret = handle->WordFontAttributes(&bool_is_bold, &bool_is_italic, &bool_is_underlined, &bool_is_monospace, &bool_is_serif,
564 &bool_is_smallcaps, pointsize, font_id);
568 *is_italic = bool_is_italic ?
TRUE :
FALSE;
570 *is_underlined = bool_is_underlined ?
TRUE :
FALSE;
572 *is_monospace = bool_is_monospace ?
TRUE :
FALSE;
574 *is_serif = bool_is_serif ?
TRUE :
FALSE;
576 *is_smallcaps = bool_is_smallcaps ?
TRUE :
FALSE;
582 return handle->WordIsFromDictionary() ?
TRUE :
FALSE;
587 return handle->WordIsNumeric() ?
TRUE :
FALSE;
592 return handle->SymbolIsSuperscript() ?
TRUE :
FALSE;
597 return handle->SymbolIsSubscript() ?
TRUE :
FALSE;
602 return handle->SymbolIsDropcap() ?
TRUE :
FALSE;