Remove TESS_CALL.

This commit is contained in:
Egor Pugin 2019-10-23 13:21:59 +03:00
parent 4ee95a615a
commit e2688c39e9
2 changed files with 308 additions and 316 deletions

View File

@ -22,188 +22,188 @@
#include "genericvector.h"
#include "strngs.h"
TESS_API const char* TESS_CALL TessVersion() {
TESS_API const char* TessVersion() {
return TessBaseAPI::Version();
}
TESS_API void TESS_CALL TessDeleteText(const char* text) {
TESS_API void TessDeleteText(const char* text) {
delete[] text;
}
TESS_API void TESS_CALL TessDeleteTextArray(char** arr) {
TESS_API void TessDeleteTextArray(char** arr) {
for (char** pos = arr; *pos != nullptr; ++pos) {
delete[] * pos;
}
delete[] arr;
}
TESS_API void TESS_CALL TessDeleteIntArray(const int* arr) {
TESS_API void TessDeleteIntArray(const int* arr) {
delete[] arr;
}
#ifndef DISABLED_LEGACY_ENGINE
TESS_API void TESS_CALL TessDeleteBlockList(BLOCK_LIST* block_list) {
TESS_API void TessDeleteBlockList(BLOCK_LIST* block_list) {
TessBaseAPI::DeleteBlockList(block_list);
}
#endif
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessTextRendererCreate(const char* outputbase) {
return new TessTextRenderer(outputbase);
}
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessHOcrRendererCreate(const char* outputbase) {
return new TessHOcrRenderer(outputbase);
}
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessHOcrRendererCreate2(const char* outputbase, BOOL font_info) {
return new TessHOcrRenderer(outputbase, font_info != 0);
}
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessAltoRendererCreate(const char* outputbase) {
return new TessAltoRenderer(outputbase);
}
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessTsvRendererCreate(const char* outputbase) {
return new TessTsvRenderer(outputbase);
}
TESS_API TessResultRenderer* TESS_CALL TessPDFRendererCreate(
TESS_API TessResultRenderer* TessPDFRendererCreate(
const char* outputbase, const char* datadir, BOOL textonly) {
return new TessPDFRenderer(outputbase, datadir, textonly != 0);
}
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessUnlvRendererCreate(const char* outputbase) {
return new TessUnlvRenderer(outputbase);
}
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessBoxTextRendererCreate(const char* outputbase) {
return new TessBoxTextRenderer(outputbase);
}
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessWordStrBoxRendererCreate(const char* outputbase) {
return new TessWordStrBoxRenderer(outputbase);
}
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessLSTMBoxRendererCreate(const char* outputbase) {
return new TessLSTMBoxRenderer(outputbase);
}
TESS_API void TESS_CALL TessDeleteResultRenderer(TessResultRenderer* renderer) {
TESS_API void TessDeleteResultRenderer(TessResultRenderer* renderer) {
delete renderer;
}
TESS_API void TESS_CALL TessResultRendererInsert(TessResultRenderer* renderer,
TESS_API void TessResultRendererInsert(TessResultRenderer* renderer,
TessResultRenderer* next) {
renderer->insert(next);
}
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessResultRendererNext(TessResultRenderer* renderer) {
return renderer->next();
}
TESS_API BOOL TESS_CALL TessResultRendererBeginDocument(
TESS_API BOOL TessResultRendererBeginDocument(
TessResultRenderer* renderer, const char* title) {
return static_cast<int>(renderer->BeginDocument(title));
}
TESS_API BOOL TESS_CALL TessResultRendererAddImage(TessResultRenderer* renderer,
TESS_API BOOL TessResultRendererAddImage(TessResultRenderer* renderer,
TessBaseAPI* api) {
return static_cast<int>(renderer->AddImage(api));
}
TESS_API BOOL TESS_CALL
TESS_API BOOL
TessResultRendererEndDocument(TessResultRenderer* renderer) {
return static_cast<int>(renderer->EndDocument());
}
TESS_API const char* TESS_CALL
TESS_API const char*
TessResultRendererExtention(TessResultRenderer* renderer) {
return renderer->file_extension();
}
TESS_API const char* TESS_CALL
TESS_API const char*
TessResultRendererTitle(TessResultRenderer* renderer) {
return renderer->title();
}
TESS_API int TESS_CALL
TESS_API int
TessResultRendererImageNum(TessResultRenderer* renderer) {
return renderer->imagenum();
}
TESS_API TessBaseAPI* TESS_CALL TessBaseAPICreate() {
TESS_API TessBaseAPI* TessBaseAPICreate() {
return new TessBaseAPI;
}
TESS_API void TESS_CALL TessBaseAPIDelete(TessBaseAPI* handle) {
TESS_API void TessBaseAPIDelete(TessBaseAPI* handle) {
delete handle;
}
TESS_API size_t TESS_CALL TessBaseAPIGetOpenCLDevice(TessBaseAPI* /*handle*/,
TESS_API size_t TessBaseAPIGetOpenCLDevice(TessBaseAPI* /*handle*/,
void** device) {
return TessBaseAPI::getOpenCLDevice(device);
}
TESS_API void TESS_CALL TessBaseAPISetInputName(TessBaseAPI* handle,
TESS_API void TessBaseAPISetInputName(TessBaseAPI* handle,
const char* name) {
handle->SetInputName(name);
}
TESS_API const char* TESS_CALL TessBaseAPIGetInputName(TessBaseAPI* handle) {
TESS_API const char* TessBaseAPIGetInputName(TessBaseAPI* handle) {
return handle->GetInputName();
}
TESS_API void TESS_CALL TessBaseAPISetInputImage(TessBaseAPI* handle,
TESS_API void TessBaseAPISetInputImage(TessBaseAPI* handle,
Pix* pix) {
handle->SetInputImage(pix);
}
TESS_API Pix* TESS_CALL TessBaseAPIGetInputImage(TessBaseAPI* handle) {
TESS_API Pix* TessBaseAPIGetInputImage(TessBaseAPI* handle) {
return handle->GetInputImage();
}
TESS_API int TESS_CALL TessBaseAPIGetSourceYResolution(TessBaseAPI* handle) {
TESS_API int TessBaseAPIGetSourceYResolution(TessBaseAPI* handle) {
return handle->GetSourceYResolution();
}
TESS_API const char* TESS_CALL TessBaseAPIGetDatapath(TessBaseAPI* handle) {
TESS_API const char* TessBaseAPIGetDatapath(TessBaseAPI* handle) {
return handle->GetDatapath();
}
TESS_API void TESS_CALL TessBaseAPISetOutputName(TessBaseAPI* handle,
TESS_API void TessBaseAPISetOutputName(TessBaseAPI* handle,
const char* name) {
handle->SetOutputName(name);
}
TESS_API BOOL TESS_CALL TessBaseAPISetVariable(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPISetVariable(TessBaseAPI* handle,
const char* name,
const char* value) {
return static_cast<int>(handle->SetVariable(name, value));
}
TESS_API BOOL TESS_CALL TessBaseAPISetDebugVariable(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPISetDebugVariable(TessBaseAPI* handle,
const char* name,
const char* value) {
return static_cast<int>(handle->SetDebugVariable(name, value));
}
TESS_API BOOL TESS_CALL TessBaseAPIGetIntVariable(const TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIGetIntVariable(const TessBaseAPI* handle,
const char* name,
int* value) {
return static_cast<int>(handle->GetIntVariable(name, value));
}
TESS_API BOOL TESS_CALL TessBaseAPIGetBoolVariable(const TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIGetBoolVariable(const TessBaseAPI* handle,
const char* name,
BOOL* value) {
bool boolValue;
@ -214,23 +214,23 @@ TESS_API BOOL TESS_CALL TessBaseAPIGetBoolVariable(const TessBaseAPI* handle,
return static_cast<int>(result);
}
TESS_API BOOL TESS_CALL TessBaseAPIGetDoubleVariable(const TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIGetDoubleVariable(const TessBaseAPI* handle,
const char* name,
double* value) {
return static_cast<int>(handle->GetDoubleVariable(name, value));
}
TESS_API const char* TESS_CALL
TESS_API const char*
TessBaseAPIGetStringVariable(const TessBaseAPI* handle, const char* name) {
return handle->GetStringVariable(name);
}
TESS_API void TESS_CALL TessBaseAPIPrintVariables(const TessBaseAPI* handle,
TESS_API void TessBaseAPIPrintVariables(const TessBaseAPI* handle,
FILE* fp) {
handle->PrintVariables(fp);
}
TESS_API BOOL TESS_CALL TessBaseAPIPrintVariablesToFile(
TESS_API BOOL TessBaseAPIPrintVariablesToFile(
const TessBaseAPI* handle, const char* filename) {
FILE* fp = fopen(filename, "w");
if (fp != nullptr) {
@ -241,13 +241,13 @@ TESS_API BOOL TESS_CALL TessBaseAPIPrintVariablesToFile(
return FALSE;
}
TESS_API BOOL TESS_CALL TessBaseAPIGetVariableAsString(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIGetVariableAsString(TessBaseAPI* handle,
const char* name,
STRING* val) {
return static_cast<int>(handle->GetVariableAsString(name, val));
}
TESS_API int TESS_CALL TessBaseAPIInit4(
TESS_API int 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) {
@ -264,7 +264,7 @@ TESS_API int TESS_CALL TessBaseAPIInit4(
&varNames, &varValues, set_only_non_debug_params != 0);
}
TESS_API int TESS_CALL TessBaseAPIInit1(TessBaseAPI* handle,
TESS_API int TessBaseAPIInit1(TessBaseAPI* handle,
const char* datapath,
const char* language,
TessOcrEngineMode oem, char** configs,
@ -273,25 +273,25 @@ TESS_API int TESS_CALL TessBaseAPIInit1(TessBaseAPI* handle,
nullptr, false);
}
TESS_API int TESS_CALL TessBaseAPIInit2(TessBaseAPI* handle,
TESS_API int TessBaseAPIInit2(TessBaseAPI* handle,
const char* datapath,
const char* language,
TessOcrEngineMode oem) {
return handle->Init(datapath, language, oem);
}
TESS_API int TESS_CALL TessBaseAPIInit3(TessBaseAPI* handle,
TESS_API int TessBaseAPIInit3(TessBaseAPI* handle,
const char* datapath,
const char* language) {
return handle->Init(datapath, language);
}
TESS_API const char* TESS_CALL
TESS_API const char*
TessBaseAPIGetInitLanguagesAsString(const TessBaseAPI* handle) {
return handle->GetInitLanguagesAsString();
}
TESS_API char** TESS_CALL
TESS_API char**
TessBaseAPIGetLoadedLanguagesAsVector(const TessBaseAPI* handle) {
GenericVector<STRING> languages;
handle->GetLoadedLanguagesAsVector(&languages);
@ -303,7 +303,7 @@ TessBaseAPIGetLoadedLanguagesAsVector(const TessBaseAPI* handle) {
return arr;
}
TESS_API char** TESS_CALL
TESS_API char**
TessBaseAPIGetAvailableLanguagesAsVector(const TessBaseAPI* handle) {
GenericVector<STRING> languages;
handle->GetAvailableLanguagesAsVector(&languages);
@ -316,38 +316,38 @@ TessBaseAPIGetAvailableLanguagesAsVector(const TessBaseAPI* handle) {
}
#ifndef DISABLED_LEGACY_ENGINE
TESS_API int TESS_CALL TessBaseAPIInitLangMod(TessBaseAPI* handle,
TESS_API int TessBaseAPIInitLangMod(TessBaseAPI* handle,
const char* datapath,
const char* language) {
return handle->InitLangMod(datapath, language);
}
#endif
TESS_API void TESS_CALL TessBaseAPIInitForAnalysePage(TessBaseAPI* handle) {
TESS_API void TessBaseAPIInitForAnalysePage(TessBaseAPI* handle) {
handle->InitForAnalysePage();
}
TESS_API void TESS_CALL TessBaseAPIReadConfigFile(TessBaseAPI* handle,
TESS_API void TessBaseAPIReadConfigFile(TessBaseAPI* handle,
const char* filename) {
handle->ReadConfigFile(filename);
}
TESS_API void TESS_CALL TessBaseAPIReadDebugConfigFile(TessBaseAPI* handle,
TESS_API void TessBaseAPIReadDebugConfigFile(TessBaseAPI* handle,
const char* filename) {
handle->ReadDebugConfigFile(filename);
}
TESS_API void TESS_CALL TessBaseAPISetPageSegMode(TessBaseAPI* handle,
TESS_API void TessBaseAPISetPageSegMode(TessBaseAPI* handle,
TessPageSegMode mode) {
handle->SetPageSegMode(mode);
}
TESS_API TessPageSegMode TESS_CALL
TESS_API TessPageSegMode
TessBaseAPIGetPageSegMode(const TessBaseAPI* handle) {
return handle->GetPageSegMode();
}
TESS_API char* TESS_CALL TessBaseAPIRect(TessBaseAPI* handle,
TESS_API char* TessBaseAPIRect(TessBaseAPI* handle,
const unsigned char* imagedata,
int bytes_per_pixel,
int bytes_per_line, int left, int top,
@ -357,13 +357,13 @@ TESS_API char* TESS_CALL TessBaseAPIRect(TessBaseAPI* handle,
}
#ifndef DISABLED_LEGACY_ENGINE
TESS_API void TESS_CALL
TESS_API void
TessBaseAPIClearAdaptiveClassifier(TessBaseAPI* handle) {
handle->ClearAdaptiveClassifier();
}
#endif
TESS_API void TESS_CALL TessBaseAPISetImage(TessBaseAPI* handle,
TESS_API void TessBaseAPISetImage(TessBaseAPI* handle,
const unsigned char* imagedata,
int width, int height,
int bytes_per_pixel,
@ -371,74 +371,74 @@ TESS_API void TESS_CALL TessBaseAPISetImage(TessBaseAPI* handle,
handle->SetImage(imagedata, width, height, bytes_per_pixel, bytes_per_line);
}
TESS_API void TESS_CALL TessBaseAPISetImage2(TessBaseAPI* handle,
TESS_API void TessBaseAPISetImage2(TessBaseAPI* handle,
struct Pix* pix) {
return handle->SetImage(pix);
}
TESS_API void TESS_CALL TessBaseAPISetSourceResolution(TessBaseAPI* handle,
TESS_API void TessBaseAPISetSourceResolution(TessBaseAPI* handle,
int ppi) {
handle->SetSourceResolution(ppi);
}
TESS_API void TESS_CALL TessBaseAPISetRectangle(TessBaseAPI* handle, int left,
TESS_API void TessBaseAPISetRectangle(TessBaseAPI* handle, int left,
int top, int width,
int height) {
handle->SetRectangle(left, top, width, height);
}
TESS_API void TESS_CALL TessBaseAPISetThresholder(
TESS_API void TessBaseAPISetThresholder(
TessBaseAPI* handle, TessImageThresholder* thresholder) {
handle->SetThresholder(thresholder);
}
TESS_API struct Pix* TESS_CALL
TESS_API struct Pix*
TessBaseAPIGetThresholdedImage(TessBaseAPI* handle) {
return handle->GetThresholdedImage();
}
TESS_API struct Boxa* TESS_CALL TessBaseAPIGetRegions(TessBaseAPI* handle,
TESS_API struct Boxa* TessBaseAPIGetRegions(TessBaseAPI* handle,
struct Pixa** pixa) {
return handle->GetRegions(pixa);
}
TESS_API struct Boxa* TESS_CALL TessBaseAPIGetTextlines(TessBaseAPI* handle,
TESS_API struct Boxa* TessBaseAPIGetTextlines(TessBaseAPI* handle,
struct Pixa** pixa,
int** blockids) {
return handle->GetTextlines(pixa, blockids);
}
TESS_API struct Boxa* TESS_CALL TessBaseAPIGetTextlines1(
TESS_API struct Boxa* TessBaseAPIGetTextlines1(
TessBaseAPI* handle, const BOOL raw_image, const int raw_padding,
struct Pixa** pixa, int** blockids, int** paraids) {
return handle->GetTextlines(raw_image != 0, raw_padding, pixa, blockids,
paraids);
}
TESS_API struct Boxa* TESS_CALL TessBaseAPIGetStrips(TessBaseAPI* handle,
TESS_API struct Boxa* TessBaseAPIGetStrips(TessBaseAPI* handle,
struct Pixa** pixa,
int** blockids) {
return handle->GetStrips(pixa, blockids);
}
TESS_API struct Boxa* TESS_CALL TessBaseAPIGetWords(TessBaseAPI* handle,
TESS_API struct Boxa* TessBaseAPIGetWords(TessBaseAPI* handle,
struct Pixa** pixa) {
return handle->GetWords(pixa);
}
TESS_API struct Boxa* TESS_CALL
TESS_API struct Boxa*
TessBaseAPIGetConnectedComponents(TessBaseAPI* handle, struct Pixa** cc) {
return handle->GetConnectedComponents(cc);
}
TESS_API struct Boxa* TESS_CALL TessBaseAPIGetComponentImages(
TESS_API struct Boxa* TessBaseAPIGetComponentImages(
TessBaseAPI* handle, TessPageIteratorLevel level, BOOL text_only,
struct Pixa** pixa, int** blockids) {
return handle->GetComponentImages(level, static_cast<bool>(text_only), pixa,
blockids);
}
TESS_API struct Boxa* TESS_CALL TessBaseAPIGetComponentImages1(
TESS_API struct Boxa* 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) {
@ -447,29 +447,29 @@ TESS_API struct Boxa* TESS_CALL TessBaseAPIGetComponentImages1(
paraids);
}
TESS_API int TESS_CALL
TESS_API int
TessBaseAPIGetThresholdedImageScaleFactor(const TessBaseAPI* handle) {
return handle->GetThresholdedImageScaleFactor();
}
TESS_API TessPageIterator* TESS_CALL
TESS_API TessPageIterator*
TessBaseAPIAnalyseLayout(TessBaseAPI* handle) {
return handle->AnalyseLayout();
}
TESS_API int TESS_CALL TessBaseAPIRecognize(TessBaseAPI* handle,
TESS_API int TessBaseAPIRecognize(TessBaseAPI* handle,
ETEXT_DESC* monitor) {
return handle->Recognize(monitor);
}
#ifndef DISABLED_LEGACY_ENGINE
TESS_API int TESS_CALL TessBaseAPIRecognizeForChopTest(TessBaseAPI* handle,
TESS_API int TessBaseAPIRecognizeForChopTest(TessBaseAPI* handle,
ETEXT_DESC* monitor) {
return handle->RecognizeForChopTest(monitor);
}
#endif
TESS_API BOOL TESS_CALL TessBaseAPIProcessPages(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIProcessPages(TessBaseAPI* handle,
const char* filename,
const char* retry_config,
int timeout_millisec,
@ -478,7 +478,7 @@ TESS_API BOOL TESS_CALL TessBaseAPIProcessPages(TessBaseAPI* handle,
handle->ProcessPages(filename, retry_config, timeout_millisec, renderer));
}
TESS_API BOOL TESS_CALL TessBaseAPIProcessPage(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIProcessPage(TessBaseAPI* handle,
struct Pix* pix, int page_index,
const char* filename,
const char* retry_config,
@ -488,107 +488,107 @@ TESS_API BOOL TESS_CALL TessBaseAPIProcessPage(TessBaseAPI* handle,
pix, page_index, filename, retry_config, timeout_millisec, renderer));
}
TESS_API TessResultIterator* TESS_CALL
TESS_API TessResultIterator*
TessBaseAPIGetIterator(TessBaseAPI* handle) {
return handle->GetIterator();
}
TESS_API TessMutableIterator* TESS_CALL
TESS_API TessMutableIterator*
TessBaseAPIGetMutableIterator(TessBaseAPI* handle) {
return handle->GetMutableIterator();
}
TESS_API char* TESS_CALL TessBaseAPIGetUTF8Text(TessBaseAPI* handle) {
TESS_API char* TessBaseAPIGetUTF8Text(TessBaseAPI* handle) {
return handle->GetUTF8Text();
}
TESS_API char* TESS_CALL TessBaseAPIGetHOCRText(TessBaseAPI* handle,
TESS_API char* TessBaseAPIGetHOCRText(TessBaseAPI* handle,
int page_number) {
return handle->GetHOCRText(nullptr, page_number);
}
TESS_API char* TESS_CALL TessBaseAPIGetAltoText(TessBaseAPI* handle,
TESS_API char* TessBaseAPIGetAltoText(TessBaseAPI* handle,
int page_number) {
return handle->GetAltoText(page_number);
}
TESS_API char* TESS_CALL TessBaseAPIGetTsvText(TessBaseAPI* handle,
TESS_API char* TessBaseAPIGetTsvText(TessBaseAPI* handle,
int page_number) {
return handle->GetTSVText(page_number);
}
TESS_API char* TESS_CALL TessBaseAPIGetBoxText(TessBaseAPI* handle,
TESS_API char* TessBaseAPIGetBoxText(TessBaseAPI* handle,
int page_number) {
return handle->GetBoxText(page_number);
}
TESS_API char* TESS_CALL TessBaseAPIGetWordStrBoxText(TessBaseAPI* handle,
TESS_API char* TessBaseAPIGetWordStrBoxText(TessBaseAPI* handle,
int page_number) {
return handle->GetWordStrBoxText(page_number);
}
TESS_API char* TESS_CALL TessBaseAPIGetLSTMBoxText(TessBaseAPI* handle,
TESS_API char* TessBaseAPIGetLSTMBoxText(TessBaseAPI* handle,
int page_number) {
return handle->GetLSTMBoxText(page_number);
}
TESS_API char* TESS_CALL TessBaseAPIGetUNLVText(TessBaseAPI* handle) {
TESS_API char* TessBaseAPIGetUNLVText(TessBaseAPI* handle) {
return handle->GetUNLVText();
}
TESS_API int TESS_CALL TessBaseAPIMeanTextConf(TessBaseAPI* handle) {
TESS_API int TessBaseAPIMeanTextConf(TessBaseAPI* handle) {
return handle->MeanTextConf();
}
TESS_API int* TESS_CALL TessBaseAPIAllWordConfidences(TessBaseAPI* handle) {
TESS_API int* TessBaseAPIAllWordConfidences(TessBaseAPI* handle) {
return handle->AllWordConfidences();
}
#ifndef DISABLED_LEGACY_ENGINE
TESS_API BOOL TESS_CALL TessBaseAPIAdaptToWordStr(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIAdaptToWordStr(TessBaseAPI* handle,
TessPageSegMode mode,
const char* wordstr) {
return static_cast<int>(handle->AdaptToWordStr(mode, wordstr));
}
#endif
TESS_API void TESS_CALL TessBaseAPIClear(TessBaseAPI* handle) {
TESS_API void TessBaseAPIClear(TessBaseAPI* handle) {
handle->Clear();
}
TESS_API void TESS_CALL TessBaseAPIEnd(TessBaseAPI* handle) {
TESS_API void TessBaseAPIEnd(TessBaseAPI* handle) {
handle->End();
}
TESS_API int TESS_CALL TessBaseAPIIsValidWord(TessBaseAPI* handle,
TESS_API int TessBaseAPIIsValidWord(TessBaseAPI* handle,
const char* word) {
return handle->IsValidWord(word);
}
TESS_API BOOL TESS_CALL TessBaseAPIGetTextDirection(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIGetTextDirection(TessBaseAPI* handle,
int* out_offset,
float* out_slope) {
return static_cast<int>(handle->GetTextDirection(out_offset, out_slope));
}
TESS_API void TESS_CALL TessBaseAPISetDictFunc(TessBaseAPI* handle,
TESS_API void TessBaseAPISetDictFunc(TessBaseAPI* handle,
TessDictFunc f) {
handle->SetDictFunc(f);
}
TESS_API void TESS_CALL
TESS_API void
TessBaseAPIClearPersistentCache(TessBaseAPI* /*handle*/) {
TessBaseAPI::ClearPersistentCache();
}
TESS_API void TESS_CALL TessBaseAPISetProbabilityInContextFunc(
TESS_API void TessBaseAPISetProbabilityInContextFunc(
TessBaseAPI* handle, TessProbabilityInContextFunc f) {
handle->SetProbabilityInContextFunc(f);
}
#ifndef DISABLED_LEGACY_ENGINE
TESS_API BOOL TESS_CALL TessBaseAPIDetectOrientationScript(
TESS_API BOOL TessBaseAPIDetectOrientationScript(
TessBaseAPI* handle, int* orient_deg, float* orient_conf,
const char** script_name, float* script_conf) {
bool success;
@ -597,19 +597,19 @@ TESS_API BOOL TESS_CALL TessBaseAPIDetectOrientationScript(
return static_cast<BOOL>(success);
}
TESS_API void TESS_CALL TessBaseAPIGetFeaturesForBlob(
TESS_API void TessBaseAPIGetFeaturesForBlob(
TessBaseAPI* handle, TBLOB* blob, INT_FEATURE_STRUCT* int_features,
int* num_features, int* FeatureOutlineIndex) {
handle->GetFeaturesForBlob(blob, int_features, num_features,
FeatureOutlineIndex);
}
TESS_API ROW* TESS_CALL TessFindRowForBox(BLOCK_LIST* blocks, int left, int top,
TESS_API ROW* TessFindRowForBox(BLOCK_LIST* blocks, int left, int top,
int right, int bottom) {
return TessBaseAPI::FindRowForBox(blocks, left, top, right, bottom);
}
TESS_API void TESS_CALL TessBaseAPIRunAdaptiveClassifier(
TESS_API void TessBaseAPIRunAdaptiveClassifier(
TessBaseAPI* handle, TBLOB* blob, int num_max_matches, int* unichar_ids,
float* ratings, int* num_matches_returned) {
handle->RunAdaptiveClassifier(blob, num_max_matches, unichar_ids, ratings,
@ -618,121 +618,121 @@ TESS_API void TESS_CALL TessBaseAPIRunAdaptiveClassifier(
#endif // ndef DISABLED_LEGACY_ENGINE
TESS_API const char* TESS_CALL TessBaseAPIGetUnichar(TessBaseAPI* handle,
TESS_API const char* TessBaseAPIGetUnichar(TessBaseAPI* handle,
int unichar_id) {
return handle->GetUnichar(unichar_id);
}
TESS_API const TessDawg* TESS_CALL TessBaseAPIGetDawg(const TessBaseAPI* handle,
TESS_API const TessDawg* TessBaseAPIGetDawg(const TessBaseAPI* handle,
int i) {
return handle->GetDawg(i);
}
TESS_API int TESS_CALL TessBaseAPINumDawgs(const TessBaseAPI* handle) {
TESS_API int TessBaseAPINumDawgs(const TessBaseAPI* handle) {
return handle->NumDawgs();
}
#ifndef DISABLED_LEGACY_ENGINE
TESS_API ROW* TESS_CALL TessMakeTessOCRRow(float baseline, float xheight,
TESS_API ROW* TessMakeTessOCRRow(float baseline, float xheight,
float descender, float ascender) {
return TessBaseAPI::MakeTessOCRRow(baseline, xheight, descender, ascender);
}
TESS_API TBLOB* TESS_CALL TessMakeTBLOB(struct Pix* pix) {
TESS_API TBLOB* TessMakeTBLOB(struct Pix* pix) {
return TessBaseAPI::MakeTBLOB(pix);
}
TESS_API void TESS_CALL TessNormalizeTBLOB(TBLOB* tblob, ROW* row,
TESS_API void TessNormalizeTBLOB(TBLOB* tblob, ROW* row,
BOOL numeric_mode) {
TessBaseAPI::NormalizeTBLOB(tblob, row, static_cast<bool>(numeric_mode));
}
#endif // ndef DISABLED_LEGACY_ENGINE
TESS_API TessOcrEngineMode TESS_CALL TessBaseAPIOem(const TessBaseAPI* handle) {
TESS_API TessOcrEngineMode TessBaseAPIOem(const TessBaseAPI* handle) {
return handle->oem();
}
TESS_API void TESS_CALL TessBaseAPIInitTruthCallback(TessBaseAPI* handle,
TESS_API void TessBaseAPIInitTruthCallback(TessBaseAPI* handle,
TessTruthCallback cb) {
handle->InitTruthCallback(cb);
}
TESS_API void TESS_CALL TessBaseAPISetMinOrientationMargin(TessBaseAPI* handle,
TESS_API void TessBaseAPISetMinOrientationMargin(TessBaseAPI* handle,
double margin) {
handle->set_min_orientation_margin(margin);
}
TESS_API void TESS_CALL TessBaseGetBlockTextOrientations(
TESS_API void TessBaseGetBlockTextOrientations(
TessBaseAPI* handle, int** block_orientation, bool** vertical_writing) {
handle->GetBlockTextOrientations(block_orientation, vertical_writing);
}
#ifndef DISABLED_LEGACY_ENGINE
TESS_API BLOCK_LIST* TESS_CALL
TESS_API BLOCK_LIST*
TessBaseAPIFindLinesCreateBlockList(TessBaseAPI* handle) {
return handle->FindLinesCreateBlockList();
}
#endif
TESS_API void TESS_CALL TessPageIteratorDelete(TessPageIterator* handle) {
TESS_API void TessPageIteratorDelete(TessPageIterator* handle) {
delete handle;
}
TESS_API TessPageIterator* TESS_CALL
TESS_API TessPageIterator*
TessPageIteratorCopy(const TessPageIterator* handle) {
return new TessPageIterator(*handle);
}
TESS_API void TESS_CALL TessPageIteratorBegin(TessPageIterator* handle) {
TESS_API void TessPageIteratorBegin(TessPageIterator* handle) {
handle->Begin();
}
TESS_API BOOL TESS_CALL TessPageIteratorNext(TessPageIterator* handle,
TESS_API BOOL TessPageIteratorNext(TessPageIterator* handle,
TessPageIteratorLevel level) {
return static_cast<int>(handle->Next(level));
}
TESS_API BOOL TESS_CALL TessPageIteratorIsAtBeginningOf(
TESS_API BOOL TessPageIteratorIsAtBeginningOf(
const TessPageIterator* handle, TessPageIteratorLevel level) {
return static_cast<int>(handle->IsAtBeginningOf(level));
}
TESS_API BOOL TESS_CALL TessPageIteratorIsAtFinalElement(
TESS_API BOOL TessPageIteratorIsAtFinalElement(
const TessPageIterator* handle, TessPageIteratorLevel level,
TessPageIteratorLevel element) {
return static_cast<int>(handle->IsAtFinalElement(level, element));
}
TESS_API BOOL TESS_CALL TessPageIteratorBoundingBox(
TESS_API BOOL TessPageIteratorBoundingBox(
const TessPageIterator* handle, TessPageIteratorLevel level, int* left,
int* top, int* right, int* bottom) {
return static_cast<int>(handle->BoundingBox(level, left, top, right, bottom));
}
TESS_API TessPolyBlockType TESS_CALL
TESS_API TessPolyBlockType
TessPageIteratorBlockType(const TessPageIterator* handle) {
return handle->BlockType();
}
TESS_API struct Pix* TESS_CALL TessPageIteratorGetBinaryImage(
TESS_API struct Pix* TessPageIteratorGetBinaryImage(
const TessPageIterator* handle, TessPageIteratorLevel level) {
return handle->GetBinaryImage(level);
}
TESS_API struct Pix* TESS_CALL TessPageIteratorGetImage(
TESS_API struct Pix* TessPageIteratorGetImage(
const TessPageIterator* handle, TessPageIteratorLevel level, int padding,
struct Pix* original_image, int* left, int* top) {
return handle->GetImage(level, padding, original_image, left, top);
}
TESS_API BOOL TESS_CALL TessPageIteratorBaseline(const TessPageIterator* handle,
TESS_API BOOL TessPageIteratorBaseline(const TessPageIterator* handle,
TessPageIteratorLevel level,
int* x1, int* y1, int* x2,
int* y2) {
return static_cast<int>(handle->Baseline(level, x1, y1, x2, y2));
}
TESS_API void TESS_CALL TessPageIteratorOrientation(
TESS_API void TessPageIteratorOrientation(
TessPageIterator* handle, TessOrientation* orientation,
TessWritingDirection* writing_direction, TessTextlineOrder* textline_order,
float* deskew_angle) {
@ -740,7 +740,7 @@ TESS_API void TESS_CALL TessPageIteratorOrientation(
deskew_angle);
}
TESS_API void TESS_CALL TessPageIteratorParagraphInfo(
TESS_API void TessPageIteratorParagraphInfo(
TessPageIterator* handle, TessParagraphJustification* justification,
BOOL* is_list_item, BOOL* is_crown, int* first_line_indent) {
bool bool_is_list_item;
@ -755,51 +755,51 @@ TESS_API void TESS_CALL TessPageIteratorParagraphInfo(
}
}
TESS_API void TESS_CALL TessResultIteratorDelete(TessResultIterator* handle) {
TESS_API void TessResultIteratorDelete(TessResultIterator* handle) {
delete handle;
}
TESS_API TessResultIterator* TESS_CALL
TESS_API TessResultIterator*
TessResultIteratorCopy(const TessResultIterator* handle) {
return new TessResultIterator(*handle);
}
TESS_API TessPageIterator* TESS_CALL
TESS_API TessPageIterator*
TessResultIteratorGetPageIterator(TessResultIterator* handle) {
return handle;
}
TESS_API const TessPageIterator* TESS_CALL
TESS_API const TessPageIterator*
TessResultIteratorGetPageIteratorConst(const TessResultIterator* handle) {
return handle;
}
TESS_API TessChoiceIterator* TESS_CALL
TESS_API TessChoiceIterator*
TessResultIteratorGetChoiceIterator(const TessResultIterator* handle) {
return new TessChoiceIterator(*handle);
}
TESS_API BOOL TESS_CALL TessResultIteratorNext(TessResultIterator* handle,
TESS_API BOOL TessResultIteratorNext(TessResultIterator* handle,
TessPageIteratorLevel level) {
return static_cast<int>(handle->Next(level));
}
TESS_API char* TESS_CALL TessResultIteratorGetUTF8Text(
TESS_API char* TessResultIteratorGetUTF8Text(
const TessResultIterator* handle, TessPageIteratorLevel level) {
return handle->GetUTF8Text(level);
}
TESS_API float TESS_CALL TessResultIteratorConfidence(
TESS_API float TessResultIteratorConfidence(
const TessResultIterator* handle, TessPageIteratorLevel level) {
return handle->Confidence(level);
}
TESS_API const char* TESS_CALL
TESS_API const char*
TessResultIteratorWordRecognitionLanguage(const TessResultIterator* handle) {
return handle->WordRecognitionLanguage();
}
TESS_API const char* TESS_CALL TessResultIteratorWordFontAttributes(
TESS_API const char* 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) {
@ -833,81 +833,81 @@ TESS_API const char* TESS_CALL TessResultIteratorWordFontAttributes(
return ret;
}
TESS_API BOOL TESS_CALL
TESS_API BOOL
TessResultIteratorWordIsFromDictionary(const TessResultIterator* handle) {
return static_cast<int>(handle->WordIsFromDictionary());
}
TESS_API BOOL TESS_CALL
TESS_API BOOL
TessResultIteratorWordIsNumeric(const TessResultIterator* handle) {
return static_cast<int>(handle->WordIsNumeric());
}
TESS_API BOOL TESS_CALL
TESS_API BOOL
TessResultIteratorSymbolIsSuperscript(const TessResultIterator* handle) {
return static_cast<int>(handle->SymbolIsSuperscript());
}
TESS_API BOOL TESS_CALL
TESS_API BOOL
TessResultIteratorSymbolIsSubscript(const TessResultIterator* handle) {
return static_cast<int>(handle->SymbolIsSubscript());
}
TESS_API BOOL TESS_CALL
TESS_API BOOL
TessResultIteratorSymbolIsDropcap(const TessResultIterator* handle) {
return static_cast<int>(handle->SymbolIsDropcap());
}
TESS_API void TESS_CALL TessChoiceIteratorDelete(TessChoiceIterator* handle) {
TESS_API void TessChoiceIteratorDelete(TessChoiceIterator* handle) {
delete handle;
}
TESS_API BOOL TESS_CALL TessChoiceIteratorNext(TessChoiceIterator* handle) {
TESS_API BOOL TessChoiceIteratorNext(TessChoiceIterator* handle) {
return static_cast<int>(handle->Next());
}
TESS_API const char* TESS_CALL
TESS_API const char*
TessChoiceIteratorGetUTF8Text(const TessChoiceIterator* handle) {
return handle->GetUTF8Text();
}
TESS_API float TESS_CALL
TESS_API float
TessChoiceIteratorConfidence(const TessChoiceIterator* handle) {
return handle->Confidence();
}
TESS_API ETEXT_DESC* TESS_CALL TessMonitorCreate() {
TESS_API ETEXT_DESC* TessMonitorCreate() {
return new ETEXT_DESC();
}
TESS_API void TESS_CALL TessMonitorDelete(ETEXT_DESC* monitor) {
TESS_API void TessMonitorDelete(ETEXT_DESC* monitor) {
delete monitor;
}
TESS_API void TESS_CALL TessMonitorSetCancelFunc(ETEXT_DESC* monitor,
TESS_API void TessMonitorSetCancelFunc(ETEXT_DESC* monitor,
TessCancelFunc cancelFunc) {
monitor->cancel = cancelFunc;
}
TESS_API void TESS_CALL TessMonitorSetCancelThis(ETEXT_DESC* monitor,
TESS_API void TessMonitorSetCancelThis(ETEXT_DESC* monitor,
void* cancelThis) {
monitor->cancel_this = cancelThis;
}
TESS_API void* TESS_CALL TessMonitorGetCancelThis(ETEXT_DESC* monitor) {
TESS_API void* TessMonitorGetCancelThis(ETEXT_DESC* monitor) {
return monitor->cancel_this;
}
TESS_API void TESS_CALL
TESS_API void
TessMonitorSetProgressFunc(ETEXT_DESC* monitor, TessProgressFunc progressFunc) {
monitor->progress_callback2 = progressFunc;
}
TESS_API int TESS_CALL TessMonitorGetProgress(ETEXT_DESC* monitor) {
TESS_API int TessMonitorGetProgress(ETEXT_DESC* monitor) {
return monitor->progress;
}
TESS_API void TESS_CALL TessMonitorSetDeadlineMSecs(ETEXT_DESC* monitor,
TESS_API void TessMonitorSetDeadlineMSecs(ETEXT_DESC* monitor,
int deadline) {
monitor->set_deadline_msecs(deadline);
}

View File

@ -38,14 +38,6 @@
extern "C" {
#endif
#ifndef TESS_CALL
# if defined(WIN32)
# define TESS_CALL __cdecl
# else
# define TESS_CALL
# endif
#endif
#ifndef BOOL
# define BOOL int
# define TRUE 1
@ -178,103 +170,103 @@ struct Pixa;
/* General free functions */
TESS_API const char* TESS_CALL TessVersion();
TESS_API void TESS_CALL TessDeleteText(const char* text);
TESS_API void TESS_CALL TessDeleteTextArray(char** arr);
TESS_API void TESS_CALL TessDeleteIntArray(const int* arr);
TESS_API const char* TessVersion();
TESS_API void TessDeleteText(const char* text);
TESS_API void TessDeleteTextArray(char** arr);
TESS_API void TessDeleteIntArray(const int* arr);
/* Renderer API */
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessTextRendererCreate(const char* outputbase);
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessHOcrRendererCreate(const char* outputbase);
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessHOcrRendererCreate2(const char* outputbase, BOOL font_info);
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessAltoRendererCreate(const char* outputbase);
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessTsvRendererCreate(const char* outputbase);
TESS_API TessResultRenderer* TESS_CALL TessPDFRendererCreate(
TESS_API TessResultRenderer* TessPDFRendererCreate(
const char* outputbase, const char* datadir, BOOL textonly);
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessUnlvRendererCreate(const char* outputbase);
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessBoxTextRendererCreate(const char* outputbase);
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessLSTMBoxRendererCreate(const char* outputbase);
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessWordStrBoxRendererCreate(const char* outputbase);
TESS_API void TESS_CALL TessDeleteResultRenderer(TessResultRenderer* renderer);
TESS_API void TESS_CALL TessResultRendererInsert(TessResultRenderer* renderer,
TESS_API void TessDeleteResultRenderer(TessResultRenderer* renderer);
TESS_API void TessResultRendererInsert(TessResultRenderer* renderer,
TessResultRenderer* next);
TESS_API TessResultRenderer* TESS_CALL
TESS_API TessResultRenderer*
TessResultRendererNext(TessResultRenderer* renderer);
TESS_API BOOL TESS_CALL TessResultRendererBeginDocument(
TESS_API BOOL TessResultRendererBeginDocument(
TessResultRenderer* renderer, const char* title);
TESS_API BOOL TESS_CALL TessResultRendererAddImage(TessResultRenderer* renderer,
TESS_API BOOL TessResultRendererAddImage(TessResultRenderer* renderer,
TessBaseAPI* api);
TESS_API BOOL TESS_CALL
TESS_API BOOL
TessResultRendererEndDocument(TessResultRenderer* renderer);
TESS_API const char* TESS_CALL
TESS_API const char*
TessResultRendererExtention(TessResultRenderer* renderer);
TESS_API const char* TESS_CALL
TESS_API const char*
TessResultRendererTitle(TessResultRenderer* renderer);
TESS_API int TESS_CALL TessResultRendererImageNum(TessResultRenderer* renderer);
TESS_API int TessResultRendererImageNum(TessResultRenderer* renderer);
/* Base API */
TESS_API TessBaseAPI* TESS_CALL TessBaseAPICreate();
TESS_API void TESS_CALL TessBaseAPIDelete(TessBaseAPI* handle);
TESS_API TessBaseAPI* TessBaseAPICreate();
TESS_API void TessBaseAPIDelete(TessBaseAPI* handle);
TESS_API size_t TESS_CALL TessBaseAPIGetOpenCLDevice(TessBaseAPI* handle,
TESS_API size_t TessBaseAPIGetOpenCLDevice(TessBaseAPI* handle,
void** device);
TESS_API void TESS_CALL TessBaseAPISetInputName(TessBaseAPI* handle,
TESS_API void TessBaseAPISetInputName(TessBaseAPI* handle,
const char* name);
TESS_API const char* TESS_CALL TessBaseAPIGetInputName(TessBaseAPI* handle);
TESS_API const char* TessBaseAPIGetInputName(TessBaseAPI* handle);
TESS_API void TESS_CALL TessBaseAPISetInputImage(TessBaseAPI* handle,
TESS_API void TessBaseAPISetInputImage(TessBaseAPI* handle,
struct Pix* pix);
TESS_API struct Pix* TESS_CALL TessBaseAPIGetInputImage(TessBaseAPI* handle);
TESS_API struct Pix* TessBaseAPIGetInputImage(TessBaseAPI* handle);
TESS_API int TESS_CALL TessBaseAPIGetSourceYResolution(TessBaseAPI* handle);
TESS_API const char* TESS_CALL TessBaseAPIGetDatapath(TessBaseAPI* handle);
TESS_API int TessBaseAPIGetSourceYResolution(TessBaseAPI* handle);
TESS_API const char* TessBaseAPIGetDatapath(TessBaseAPI* handle);
TESS_API void TESS_CALL TessBaseAPISetOutputName(TessBaseAPI* handle,
TESS_API void TessBaseAPISetOutputName(TessBaseAPI* handle,
const char* name);
TESS_API BOOL TESS_CALL TessBaseAPISetVariable(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPISetVariable(TessBaseAPI* handle,
const char* name,
const char* value);
TESS_API BOOL TESS_CALL TessBaseAPISetDebugVariable(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPISetDebugVariable(TessBaseAPI* handle,
const char* name,
const char* value);
TESS_API BOOL TESS_CALL TessBaseAPIGetIntVariable(const TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIGetIntVariable(const TessBaseAPI* handle,
const char* name, int* value);
TESS_API BOOL TESS_CALL TessBaseAPIGetBoolVariable(const TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIGetBoolVariable(const TessBaseAPI* handle,
const char* name,
BOOL* value);
TESS_API BOOL TESS_CALL TessBaseAPIGetDoubleVariable(const TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIGetDoubleVariable(const TessBaseAPI* handle,
const char* name,
double* value);
TESS_API const char* TESS_CALL
TESS_API const char*
TessBaseAPIGetStringVariable(const TessBaseAPI* handle, const char* name);
TESS_API void TESS_CALL TessBaseAPIPrintVariables(const TessBaseAPI* handle,
TESS_API void TessBaseAPIPrintVariables(const TessBaseAPI* handle,
FILE* fp);
TESS_API BOOL TESS_CALL TessBaseAPIPrintVariablesToFile(
TESS_API BOOL TessBaseAPIPrintVariablesToFile(
const TessBaseAPI* handle, const char* filename);
#ifdef TESS_CAPI_INCLUDE_BASEAPI
TESS_API BOOL TESS_CALL TessBaseAPIGetVariableAsString(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIGetVariableAsString(TessBaseAPI* handle,
const char* name,
STRING* val);
TESS_API int TESS_CALL TessBaseAPIInit(
TESS_API int TessBaseAPIInit(
TessBaseAPI* handle, const char* datapath, const char* language,
TessOcrEngineMode mode, char** configs, int configs_size,
const STRING* vars_vec, size_t vars_vec_size, const STRING* vars_values,
@ -282,340 +274,340 @@ TESS_API int TESS_CALL TessBaseAPIInit(
#endif // def TESS_CAPI_INCLUDE_BASEAPI
TESS_API int TESS_CALL TessBaseAPIInit1(TessBaseAPI* handle,
TESS_API int TessBaseAPIInit1(TessBaseAPI* handle,
const char* datapath,
const char* language,
TessOcrEngineMode oem, char** configs,
int configs_size);
TESS_API int TESS_CALL TessBaseAPIInit2(TessBaseAPI* handle,
TESS_API int TessBaseAPIInit2(TessBaseAPI* handle,
const char* datapath,
const char* language,
TessOcrEngineMode oem);
TESS_API int TESS_CALL TessBaseAPIInit3(TessBaseAPI* handle,
TESS_API int TessBaseAPIInit3(TessBaseAPI* handle,
const char* datapath,
const char* language);
TESS_API int TESS_CALL TessBaseAPIInit4(
TESS_API int 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);
TESS_API const char* TESS_CALL
TESS_API const char*
TessBaseAPIGetInitLanguagesAsString(const TessBaseAPI* handle);
TESS_API char** TESS_CALL
TESS_API char**
TessBaseAPIGetLoadedLanguagesAsVector(const TessBaseAPI* handle);
TESS_API char** TESS_CALL
TESS_API char**
TessBaseAPIGetAvailableLanguagesAsVector(const TessBaseAPI* handle);
TESS_API int TESS_CALL TessBaseAPIInitLangMod(TessBaseAPI* handle,
TESS_API int TessBaseAPIInitLangMod(TessBaseAPI* handle,
const char* datapath,
const char* language);
TESS_API void TESS_CALL TessBaseAPIInitForAnalysePage(TessBaseAPI* handle);
TESS_API void TessBaseAPIInitForAnalysePage(TessBaseAPI* handle);
TESS_API void TESS_CALL TessBaseAPIReadConfigFile(TessBaseAPI* handle,
TESS_API void TessBaseAPIReadConfigFile(TessBaseAPI* handle,
const char* filename);
TESS_API void TESS_CALL TessBaseAPIReadDebugConfigFile(TessBaseAPI* handle,
TESS_API void TessBaseAPIReadDebugConfigFile(TessBaseAPI* handle,
const char* filename);
TESS_API void TESS_CALL TessBaseAPISetPageSegMode(TessBaseAPI* handle,
TESS_API void TessBaseAPISetPageSegMode(TessBaseAPI* handle,
TessPageSegMode mode);
TESS_API TessPageSegMode TESS_CALL
TESS_API TessPageSegMode
TessBaseAPIGetPageSegMode(const TessBaseAPI* handle);
TESS_API char* TESS_CALL TessBaseAPIRect(TessBaseAPI* handle,
TESS_API char* TessBaseAPIRect(TessBaseAPI* handle,
const unsigned char* imagedata,
int bytes_per_pixel,
int bytes_per_line, int left, int top,
int width, int height);
TESS_API void TESS_CALL TessBaseAPIClearAdaptiveClassifier(TessBaseAPI* handle);
TESS_API void TessBaseAPIClearAdaptiveClassifier(TessBaseAPI* handle);
TESS_API void TESS_CALL TessBaseAPISetImage(TessBaseAPI* handle,
TESS_API void TessBaseAPISetImage(TessBaseAPI* handle,
const unsigned char* imagedata,
int width, int height,
int bytes_per_pixel,
int bytes_per_line);
TESS_API void TESS_CALL TessBaseAPISetImage2(TessBaseAPI* handle,
TESS_API void TessBaseAPISetImage2(TessBaseAPI* handle,
struct Pix* pix);
TESS_API void TESS_CALL TessBaseAPISetSourceResolution(TessBaseAPI* handle,
TESS_API void TessBaseAPISetSourceResolution(TessBaseAPI* handle,
int ppi);
TESS_API void TESS_CALL TessBaseAPISetRectangle(TessBaseAPI* handle, int left,
TESS_API void TessBaseAPISetRectangle(TessBaseAPI* handle, int left,
int top, int width, int height);
#ifdef TESS_CAPI_INCLUDE_BASEAPI
TESS_API void TESS_CALL TessBaseAPISetThresholder(
TESS_API void TessBaseAPISetThresholder(
TessBaseAPI* handle, TessImageThresholder* thresholder);
#endif
TESS_API struct Pix* TESS_CALL
TESS_API struct Pix*
TessBaseAPIGetThresholdedImage(TessBaseAPI* handle);
TESS_API struct Boxa* TESS_CALL TessBaseAPIGetRegions(TessBaseAPI* handle,
TESS_API struct Boxa* TessBaseAPIGetRegions(TessBaseAPI* handle,
struct Pixa** pixa);
TESS_API struct Boxa* TESS_CALL TessBaseAPIGetTextlines(TessBaseAPI* handle,
TESS_API struct Boxa* TessBaseAPIGetTextlines(TessBaseAPI* handle,
struct Pixa** pixa,
int** blockids);
TESS_API struct Boxa* TESS_CALL
TESS_API struct Boxa*
TessBaseAPIGetTextlines1(TessBaseAPI* handle, BOOL raw_image, int raw_padding,
struct Pixa** pixa, int** blockids, int** paraids);
TESS_API struct Boxa* TESS_CALL TessBaseAPIGetStrips(TessBaseAPI* handle,
TESS_API struct Boxa* TessBaseAPIGetStrips(TessBaseAPI* handle,
struct Pixa** pixa,
int** blockids);
TESS_API struct Boxa* TESS_CALL TessBaseAPIGetWords(TessBaseAPI* handle,
TESS_API struct Boxa* TessBaseAPIGetWords(TessBaseAPI* handle,
struct Pixa** pixa);
TESS_API struct Boxa* TESS_CALL
TESS_API struct Boxa*
TessBaseAPIGetConnectedComponents(TessBaseAPI* handle, struct Pixa** cc);
TESS_API struct Boxa* TESS_CALL TessBaseAPIGetComponentImages(
TESS_API struct Boxa* TessBaseAPIGetComponentImages(
TessBaseAPI* handle, TessPageIteratorLevel level, BOOL text_only,
struct Pixa** pixa, int** blockids);
TESS_API struct Boxa* TESS_CALL TessBaseAPIGetComponentImages1(
TESS_API struct Boxa* TessBaseAPIGetComponentImages1(
TessBaseAPI* handle, TessPageIteratorLevel level, BOOL text_only,
BOOL raw_image, int raw_padding, struct Pixa** pixa, int** blockids,
int** paraids);
TESS_API int TESS_CALL
TESS_API int
TessBaseAPIGetThresholdedImageScaleFactor(const TessBaseAPI* handle);
TESS_API TessPageIterator* TESS_CALL
TESS_API TessPageIterator*
TessBaseAPIAnalyseLayout(TessBaseAPI* handle);
TESS_API int TESS_CALL TessBaseAPIRecognize(TessBaseAPI* handle,
TESS_API int TessBaseAPIRecognize(TessBaseAPI* handle,
ETEXT_DESC* monitor);
#ifndef DISABLED_LEGACY_ENGINE
TESS_API int TESS_CALL TessBaseAPIRecognizeForChopTest(TessBaseAPI* handle,
TESS_API int TessBaseAPIRecognizeForChopTest(TessBaseAPI* handle,
ETEXT_DESC* monitor);
#endif
TESS_API BOOL TESS_CALL TessBaseAPIProcessPages(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIProcessPages(TessBaseAPI* handle,
const char* filename,
const char* retry_config,
int timeout_millisec,
TessResultRenderer* renderer);
TESS_API BOOL TESS_CALL TessBaseAPIProcessPage(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIProcessPage(TessBaseAPI* handle,
struct Pix* pix, int page_index,
const char* filename,
const char* retry_config,
int timeout_millisec,
TessResultRenderer* renderer);
TESS_API TessResultIterator* TESS_CALL
TESS_API TessResultIterator*
TessBaseAPIGetIterator(TessBaseAPI* handle);
TESS_API TessMutableIterator* TESS_CALL
TESS_API TessMutableIterator*
TessBaseAPIGetMutableIterator(TessBaseAPI* handle);
TESS_API char* TESS_CALL TessBaseAPIGetUTF8Text(TessBaseAPI* handle);
TESS_API char* TESS_CALL TessBaseAPIGetHOCRText(TessBaseAPI* handle,
TESS_API char* TessBaseAPIGetUTF8Text(TessBaseAPI* handle);
TESS_API char* TessBaseAPIGetHOCRText(TessBaseAPI* handle,
int page_number);
TESS_API char* TESS_CALL TessBaseAPIGetAltoText(TessBaseAPI* handle,
TESS_API char* TessBaseAPIGetAltoText(TessBaseAPI* handle,
int page_number);
TESS_API char* TESS_CALL TessBaseAPIGetTsvText(TessBaseAPI* handle,
TESS_API char* TessBaseAPIGetTsvText(TessBaseAPI* handle,
int page_number);
TESS_API char* TESS_CALL TessBaseAPIGetBoxText(TessBaseAPI* handle,
TESS_API char* TessBaseAPIGetBoxText(TessBaseAPI* handle,
int page_number);
TESS_API char* TESS_CALL TessBaseAPIGetLSTMBoxText(TessBaseAPI* handle,
TESS_API char* TessBaseAPIGetLSTMBoxText(TessBaseAPI* handle,
int page_number);
TESS_API char* TESS_CALL TessBaseAPIGetWordStrBoxText(TessBaseAPI* handle,
TESS_API char* TessBaseAPIGetWordStrBoxText(TessBaseAPI* handle,
int page_number);
TESS_API char* TESS_CALL TessBaseAPIGetUNLVText(TessBaseAPI* handle);
TESS_API int TESS_CALL TessBaseAPIMeanTextConf(TessBaseAPI* handle);
TESS_API char* TessBaseAPIGetUNLVText(TessBaseAPI* handle);
TESS_API int TessBaseAPIMeanTextConf(TessBaseAPI* handle);
TESS_API int* TESS_CALL TessBaseAPIAllWordConfidences(TessBaseAPI* handle);
TESS_API int* TessBaseAPIAllWordConfidences(TessBaseAPI* handle);
#ifndef DISABLED_LEGACY_ENGINE
TESS_API BOOL TESS_CALL TessBaseAPIAdaptToWordStr(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIAdaptToWordStr(TessBaseAPI* handle,
TessPageSegMode mode,
const char* wordstr);
#endif // ndef DISABLED_LEGACY_ENGINE
TESS_API void TESS_CALL TessBaseAPIClear(TessBaseAPI* handle);
TESS_API void TESS_CALL TessBaseAPIEnd(TessBaseAPI* handle);
TESS_API void TessBaseAPIClear(TessBaseAPI* handle);
TESS_API void TessBaseAPIEnd(TessBaseAPI* handle);
TESS_API int TESS_CALL TessBaseAPIIsValidWord(TessBaseAPI* handle,
TESS_API int TessBaseAPIIsValidWord(TessBaseAPI* handle,
const char* word);
TESS_API BOOL TESS_CALL TessBaseAPIGetTextDirection(TessBaseAPI* handle,
TESS_API BOOL TessBaseAPIGetTextDirection(TessBaseAPI* handle,
int* out_offset,
float* out_slope);
#ifdef TESS_CAPI_INCLUDE_BASEAPI
TESS_API void TESS_CALL TessBaseAPISetDictFunc(TessBaseAPI* handle,
TESS_API void TessBaseAPISetDictFunc(TessBaseAPI* handle,
TessDictFunc f);
TESS_API void TESS_CALL TessBaseAPIClearPersistentCache(TessBaseAPI* handle);
TESS_API void TessBaseAPIClearPersistentCache(TessBaseAPI* handle);
TESS_API void TESS_CALL TessBaseAPISetProbabilityInContextFunc(
TESS_API void TessBaseAPISetProbabilityInContextFunc(
TessBaseAPI* handle, TessProbabilityInContextFunc f);
// Call TessDeleteText(*best_script_name) to free memory allocated by this
// function
TESS_API BOOL TESS_CALL TessBaseAPIDetectOrientationScript(
TESS_API BOOL TessBaseAPIDetectOrientationScript(
TessBaseAPI* handle, int* orient_deg, float* orient_conf,
const char** script_name, float* script_conf);
#endif // def TESS_CAPI_INCLUDE_BASEAPI
TESS_API const char* TESS_CALL TessBaseAPIGetUnichar(TessBaseAPI* handle,
TESS_API const char* TessBaseAPIGetUnichar(TessBaseAPI* handle,
int unichar_id);
TESS_API void TESS_CALL TessBaseAPISetMinOrientationMargin(TessBaseAPI* handle,
TESS_API void TessBaseAPISetMinOrientationMargin(TessBaseAPI* handle,
double margin);
#ifdef TESS_CAPI_INCLUDE_BASEAPI
TESS_API const TessDawg* TESS_CALL TessBaseAPIGetDawg(const TessBaseAPI* handle,
TESS_API const TessDawg* TessBaseAPIGetDawg(const TessBaseAPI* handle,
int i);
TESS_API int TESS_CALL TessBaseAPINumDawgs(const TessBaseAPI* handle);
TESS_API int TessBaseAPINumDawgs(const TessBaseAPI* handle);
TESS_API TessOcrEngineMode TESS_CALL TessBaseAPIOem(const TessBaseAPI* handle);
TESS_API TessOcrEngineMode TessBaseAPIOem(const TessBaseAPI* handle);
TESS_API void TESS_CALL TessBaseAPIInitTruthCallback(TessBaseAPI* handle,
TESS_API void TessBaseAPIInitTruthCallback(TessBaseAPI* handle,
TessTruthCallback cb);
TESS_API void TESS_CALL TessBaseGetBlockTextOrientations(
TESS_API void TessBaseGetBlockTextOrientations(
TessBaseAPI* handle, int** block_orientation, bool** vertical_writing);
#endif
/* Page iterator */
TESS_API void TESS_CALL TessPageIteratorDelete(TessPageIterator* handle);
TESS_API void TessPageIteratorDelete(TessPageIterator* handle);
TESS_API TessPageIterator* TESS_CALL
TESS_API TessPageIterator*
TessPageIteratorCopy(const TessPageIterator* handle);
TESS_API void TESS_CALL TessPageIteratorBegin(TessPageIterator* handle);
TESS_API void TessPageIteratorBegin(TessPageIterator* handle);
TESS_API BOOL TESS_CALL TessPageIteratorNext(TessPageIterator* handle,
TESS_API BOOL TessPageIteratorNext(TessPageIterator* handle,
TessPageIteratorLevel level);
TESS_API BOOL TESS_CALL TessPageIteratorIsAtBeginningOf(
TESS_API BOOL TessPageIteratorIsAtBeginningOf(
const TessPageIterator* handle, TessPageIteratorLevel level);
TESS_API BOOL TESS_CALL TessPageIteratorIsAtFinalElement(
TESS_API BOOL TessPageIteratorIsAtFinalElement(
const TessPageIterator* handle, TessPageIteratorLevel level,
TessPageIteratorLevel element);
TESS_API BOOL TESS_CALL TessPageIteratorBoundingBox(
TESS_API BOOL TessPageIteratorBoundingBox(
const TessPageIterator* handle, TessPageIteratorLevel level, int* left,
int* top, int* right, int* bottom);
TESS_API TessPolyBlockType TESS_CALL
TESS_API TessPolyBlockType
TessPageIteratorBlockType(const TessPageIterator* handle);
TESS_API struct Pix* TESS_CALL TessPageIteratorGetBinaryImage(
TESS_API struct Pix* TessPageIteratorGetBinaryImage(
const TessPageIterator* handle, TessPageIteratorLevel level);
TESS_API struct Pix* TESS_CALL TessPageIteratorGetImage(
TESS_API struct Pix* TessPageIteratorGetImage(
const TessPageIterator* handle, TessPageIteratorLevel level, int padding,
struct Pix* original_image, int* left, int* top);
TESS_API BOOL TESS_CALL TessPageIteratorBaseline(const TessPageIterator* handle,
TESS_API BOOL TessPageIteratorBaseline(const TessPageIterator* handle,
TessPageIteratorLevel level,
int* x1, int* y1, int* x2,
int* y2);
TESS_API void TESS_CALL TessPageIteratorOrientation(
TESS_API void TessPageIteratorOrientation(
TessPageIterator* handle, TessOrientation* orientation,
TessWritingDirection* writing_direction, TessTextlineOrder* textline_order,
float* deskew_angle);
TESS_API void TESS_CALL TessPageIteratorParagraphInfo(
TESS_API void TessPageIteratorParagraphInfo(
TessPageIterator* handle, TessParagraphJustification* justification,
BOOL* is_list_item, BOOL* is_crown, int* first_line_indent);
/* Result iterator */
TESS_API void TESS_CALL TessResultIteratorDelete(TessResultIterator* handle);
TESS_API TessResultIterator* TESS_CALL
TESS_API void TessResultIteratorDelete(TessResultIterator* handle);
TESS_API TessResultIterator*
TessResultIteratorCopy(const TessResultIterator* handle);
TESS_API TessPageIterator* TESS_CALL
TESS_API TessPageIterator*
TessResultIteratorGetPageIterator(TessResultIterator* handle);
TESS_API const TessPageIterator* TESS_CALL
TESS_API const TessPageIterator*
TessResultIteratorGetPageIteratorConst(const TessResultIterator* handle);
TESS_API TessChoiceIterator* TESS_CALL
TESS_API TessChoiceIterator*
TessResultIteratorGetChoiceIterator(const TessResultIterator* handle);
TESS_API BOOL TESS_CALL TessResultIteratorNext(TessResultIterator* handle,
TESS_API BOOL TessResultIteratorNext(TessResultIterator* handle,
TessPageIteratorLevel level);
TESS_API char* TESS_CALL TessResultIteratorGetUTF8Text(
TESS_API char* TessResultIteratorGetUTF8Text(
const TessResultIterator* handle, TessPageIteratorLevel level);
TESS_API float TESS_CALL TessResultIteratorConfidence(
TESS_API float TessResultIteratorConfidence(
const TessResultIterator* handle, TessPageIteratorLevel level);
TESS_API const char* TESS_CALL
TESS_API const char*
TessResultIteratorWordRecognitionLanguage(const TessResultIterator* handle);
TESS_API const char* TESS_CALL TessResultIteratorWordFontAttributes(
TESS_API const char* 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);
TESS_API BOOL TESS_CALL
TESS_API BOOL
TessResultIteratorWordIsFromDictionary(const TessResultIterator* handle);
TESS_API BOOL TESS_CALL
TESS_API BOOL
TessResultIteratorWordIsNumeric(const TessResultIterator* handle);
TESS_API BOOL TESS_CALL
TESS_API BOOL
TessResultIteratorSymbolIsSuperscript(const TessResultIterator* handle);
TESS_API BOOL TESS_CALL
TESS_API BOOL
TessResultIteratorSymbolIsSubscript(const TessResultIterator* handle);
TESS_API BOOL TESS_CALL
TESS_API BOOL
TessResultIteratorSymbolIsDropcap(const TessResultIterator* handle);
TESS_API void TESS_CALL TessChoiceIteratorDelete(TessChoiceIterator* handle);
TESS_API BOOL TESS_CALL TessChoiceIteratorNext(TessChoiceIterator* handle);
TESS_API const char* TESS_CALL
TESS_API void TessChoiceIteratorDelete(TessChoiceIterator* handle);
TESS_API BOOL TessChoiceIteratorNext(TessChoiceIterator* handle);
TESS_API const char*
TessChoiceIteratorGetUTF8Text(const TessChoiceIterator* handle);
TESS_API float TESS_CALL
TESS_API float
TessChoiceIteratorConfidence(const TessChoiceIterator* handle);
/* Progress monitor */
TESS_API ETEXT_DESC* TESS_CALL TessMonitorCreate();
TESS_API void TESS_CALL TessMonitorDelete(ETEXT_DESC* monitor);
TESS_API void TESS_CALL TessMonitorSetCancelFunc(ETEXT_DESC* monitor,
TESS_API ETEXT_DESC* TessMonitorCreate();
TESS_API void TessMonitorDelete(ETEXT_DESC* monitor);
TESS_API void TessMonitorSetCancelFunc(ETEXT_DESC* monitor,
TessCancelFunc cancelFunc);
TESS_API void TESS_CALL TessMonitorSetCancelThis(ETEXT_DESC* monitor,
TESS_API void TessMonitorSetCancelThis(ETEXT_DESC* monitor,
void* cancelThis);
TESS_API void* TESS_CALL TessMonitorGetCancelThis(ETEXT_DESC* monitor);
TESS_API void TESS_CALL
TESS_API void* TessMonitorGetCancelThis(ETEXT_DESC* monitor);
TESS_API void
TessMonitorSetProgressFunc(ETEXT_DESC* monitor, TessProgressFunc progressFunc);
TESS_API int TESS_CALL TessMonitorGetProgress(ETEXT_DESC* monitor);
TESS_API void TESS_CALL TessMonitorSetDeadlineMSecs(ETEXT_DESC* monitor,
TESS_API int TessMonitorGetProgress(ETEXT_DESC* monitor);
TESS_API void TessMonitorSetDeadlineMSecs(ETEXT_DESC* monitor,
int deadline);
#ifndef DISABLED_LEGACY_ENGINE
# ifdef TESS_CAPI_INCLUDE_BASEAPI
TESS_API void TESS_CALL TessBaseAPISetFillLatticeFunc(TessBaseAPI* handle,
TESS_API void TessBaseAPISetFillLatticeFunc(TessBaseAPI* handle,
TessFillLatticeFunc f);
TESS_API void TESS_CALL TessBaseAPIGetFeaturesForBlob(
TESS_API void TessBaseAPIGetFeaturesForBlob(
TessBaseAPI* handle, TBLOB* blob, INT_FEATURE_STRUCT* int_features,
int* num_features, int* FeatureOutlineIndex);
TESS_API ROW* TESS_CALL TessFindRowForBox(BLOCK_LIST* blocks, int left, int top,
TESS_API ROW* TessFindRowForBox(BLOCK_LIST* blocks, int left, int top,
int right, int bottom);
TESS_API void TESS_CALL TessBaseAPIRunAdaptiveClassifier(
TESS_API void TessBaseAPIRunAdaptiveClassifier(
TessBaseAPI* handle, TBLOB* blob, int num_max_matches, int* unichar_ids,
float* ratings, int* num_matches_returned);
TESS_API ROW* TESS_CALL TessMakeTessOCRRow(float baseline, float xheight,
TESS_API ROW* TessMakeTessOCRRow(float baseline, float xheight,
float descender, float ascender);
TESS_API TBLOB* TESS_CALL TessMakeTBLOB(Pix* pix);
TESS_API TBLOB* TessMakeTBLOB(Pix* pix);
TESS_API void TESS_CALL TessNormalizeTBLOB(TBLOB* tblob, ROW* row,
TESS_API void TessNormalizeTBLOB(TBLOB* tblob, ROW* row,
BOOL numeric_mode);
TESS_API BLOCK_LIST* TESS_CALL
TESS_API BLOCK_LIST*
TessBaseAPIFindLinesCreateBlockList(TessBaseAPI* handle);
TESS_API void TESS_CALL TessDeleteBlockList(BLOCK_LIST* block_list);
TESS_API void TessDeleteBlockList(BLOCK_LIST* block_list);
# endif // def TESS_CAPI_INCLUDE_BASEAPI