Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Typedefs | Enumerations | Functions
capi.h File Reference
`#include "baseapi.h"`
`#include "pageiterator.h"`
`#include "resultiterator.h"`
`#include "platform.h"`
`#include <stdio.h>`

Go to the source code of this file.

## Macros

#define | TESS_CALL
#define | BOOL int
#define | TRUE 1
#define | FALSE 0

## Typedefs

typedef struct TessBaseAPI | TessBaseAPI
typedef struct TessPageIterator | TessPageIterator
typedef struct TessResultIterator | TessResultIterator
typedef struct TessMutableIterator | TessMutableIterator
typedef enum TessOcrEngineMode | TessOcrEngineMode
typedef enum TessPageSegMode | TessPageSegMode
typedef enum TessPageIteratorLevel | TessPageIteratorLevel
typedef enum TessPolyBlockType | TessPolyBlockType
typedef enum TessOrientation | TessOrientation
typedef enum TessWritingDirection | TessWritingDirection
typedef enum TessTextlineOrder | TessTextlineOrder
typedef struct ETEXT_DESC | ETEXT_DESC
typedef struct Pix | PIX
typedef struct Boxa | BOXA
typedef struct Pixa | PIXA

## Enumerations

enum | TessOcrEngineMode { OEM_TESSERACT_ONLY, OEM_CUBE_ONLY, OEM_TESSERACT_CUBE_COMBINED, OEM_DEFAULT }
enum | TessPageSegMode { PSM_OSD_ONLY, PSM_AUTO_OSD, PSM_AUTO_ONLY, PSM_AUTO, PSM_SINGLE_COLUMN, PSM_SINGLE_BLOCK_VERT_TEXT, PSM_SINGLE_BLOCK, PSM_SINGLE_LINE, PSM_SINGLE_WORD, PSM_CIRCLE_WORD, PSM_SINGLE_CHAR, PSM_COUNT }
enum | TessPageIteratorLevel { RIL_BLOCK, RIL_PARA, RIL_TEXTLINE, RIL_WORD, RIL_SYMBOL }
enum | TessPolyBlockType { PT_UNKNOWN, PT_FLOWING_TEXT, PT_HEADING_TEXT, PT_PULLOUT_TEXT, PT_TABLE, PT_VERTICAL_TEXT, PT_CAPTION_TEXT, PT_FLOWING_IMAGE, PT_HEADING_IMAGE, PT_PULLOUT_IMAGE, PT_HORZ_LINE, PT_VERT_LINE, PT_NOISE, PT_COUNT }
enum | TessOrientation { ORIENTATION_PAGE_UP, ORIENTATION_PAGE_RIGHT, ORIENTATION_PAGE_DOWN, ORIENTATION_PAGE_LEFT }
enum | TessWritingDirection { WRITING_DIRECTION_LEFT_TO_RIGHT, WRITING_DIRECTION_RIGHT_TO_LEFT, WRITING_DIRECTION_TOP_TO_BOTTOM }
enum | TessTextlineOrder { TEXTLINE_ORDER_LEFT_TO_RIGHT, TEXTLINE_ORDER_RIGHT_TO_LEFT, TEXTLINE_ORDER_TOP_TO_BOTTOM }

## Functions

TESS_API const char *TESS_CALL | TessVersion ()
TESS_API void TESS_CALL | TessDeleteText (char *text)
TESS_API void TESS_CALL | TessDeleteTextArray (char **arr)
TESS_API void TESS_CALL | TessDeleteIntArray (int *arr)
TESS_API TessBaseAPI *TESS_CALL | TessBaseAPICreate ()
TESS_API void TESS_CALL | TessBaseAPIDelete (TessBaseAPI *handle)
TESS_API void TESS_CALL | TessBaseAPISetInputName (TessBaseAPI *handle, const char *name)
TESS_API void TESS_CALL | TessBaseAPISetOutputName (TessBaseAPI *handle, const char *name)
TESS_API BOOL TESS_CALL | TessBaseAPISetVariable (TessBaseAPI *handle, const char *name, const char *value)
TESS_API BOOL TESS_CALL | TessBaseAPISetDebugVariable (TessBaseAPI *handle, const char *name, const char *value)
TESS_API BOOL TESS_CALL | TessBaseAPIGetIntVariable (const TessBaseAPI *handle, const char *name, int *value)
TESS_API BOOL TESS_CALL | TessBaseAPIGetBoolVariable (const TessBaseAPI *handle, const char *name, BOOL *value)
TESS_API BOOL TESS_CALL | TessBaseAPIGetDoubleVariable (const TessBaseAPI *handle, const char *name, double *value)
TESS_API const char *TESS_CALL | TessBaseAPIGetStringVariable (const TessBaseAPI *handle, const char *name)
TESS_API void TESS_CALL | TessBaseAPIPrintVariables (const TessBaseAPI *handle, FILE *fp)
TESS_API BOOL TESS_CALL | TessBaseAPIPrintVariablesToFile (const TessBaseAPI *handle, const char *filename)
TESS_API int TESS_CALL | TessBaseAPIInit1 (TessBaseAPI *handle, const char *datapath, const char *language, TessOcrEngineMode oem, char **configs, int configs_size)
TESS_API int TESS_CALL | TessBaseAPIInit2 (TessBaseAPI *handle, const char *datapath, const char *language, TessOcrEngineMode oem)
TESS_API int TESS_CALL | TessBaseAPIInit3 (TessBaseAPI *handle, const char *datapath, const char *language)
TESS_API const char *TESS_CALL | TessBaseAPIGetInitLanguagesAsString (const TessBaseAPI *handle)
TESS_API char **TESS_CALL | TessBaseAPIGetLoadedLanguagesAsVector (const TessBaseAPI *handle)
TESS_API char **TESS_CALL | TessBaseAPIGetAvailableLanguagesAsVector (const TessBaseAPI *handle)
TESS_API int TESS_CALL | TessBaseAPIInitLangMod (TessBaseAPI *handle, const char *datapath, const char *language)
TESS_API void TESS_CALL | TessBaseAPIInitForAnalysePage (TessBaseAPI *handle)
TESS_API void TESS_CALL | TessBaseAPIReadConfigFile (TessBaseAPI *handle, const char *filename)
TESS_API void TESS_CALL | TessBaseAPIReadDebugConfigFile (TessBaseAPI *handle, const char *filename)
TESS_API void TESS_CALL | TessBaseAPISetPageSegMode (TessBaseAPI *handle, TessPageSegMode mode)
TESS_API TessPageSegMode TESS_CALL | TessBaseAPIGetPageSegMode (const TessBaseAPI *handle)
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)
TESS_API void TESS_CALL | TessBaseAPIClearAdaptiveClassifier (TessBaseAPI *handle)
TESS_API void TESS_CALL | 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, const PIX *pix)
TESS_API void TESS_CALL | TessBaseAPISetSourceResolution (TessBaseAPI *handle, int ppi)
TESS_API void TESS_CALL | TessBaseAPISetRectangle (TessBaseAPI *handle, int left, int top, int width, int height)
TESS_API PIX *TESS_CALL | TessBaseAPIGetThresholdedImage (TessBaseAPI *handle)
TESS_API BOXA *TESS_CALL | TessBaseAPIGetRegions (TessBaseAPI *handle, PIXA **pixa)
TESS_API BOXA *TESS_CALL | TessBaseAPIGetTextlines (TessBaseAPI *handle, PIXA **pixa, int **blockids)
TESS_API BOXA *TESS_CALL | TessBaseAPIGetStrips (TessBaseAPI *handle, PIXA **pixa, int **blockids)
TESS_API BOXA *TESS_CALL | TessBaseAPIGetWords (TessBaseAPI *handle, PIXA **pixa)
TESS_API BOXA *TESS_CALL | TessBaseAPIGetConnectedComponents (TessBaseAPI *handle, PIXA **cc)
TESS_API BOXA *TESS_CALL | TessBaseAPIGetComponentImages (TessBaseAPI *handle, TessPageIteratorLevel level, BOOL text_only, PIXA **pixa, int **blockids)
TESS_API int TESS_CALL | TessBaseAPIGetThresholdedImageScaleFactor (const TessBaseAPI *handle)
TESS_API void TESS_CALL | TessBaseAPIDumpPGM (TessBaseAPI *handle, const char *filename)
TESS_API TessPageIterator *TESS_CALL | TessBaseAPIAnalyseLayout (TessBaseAPI *handle)
TESS_API int TESS_CALL | TessBaseAPIRecognize (TessBaseAPI *handle, ETEXT_DESC *monitor)
TESS_API int TESS_CALL | TessBaseAPIRecognizeForChopTest (TessBaseAPI *handle, ETEXT_DESC *monitor)
TESS_API char *TESS_CALL | TessBaseAPIProcessPages (TessBaseAPI *handle, const char *filename, const char *retry_config, int timeout_millisec)
TESS_API char *TESS_CALL | TessBaseAPIProcessPage (TessBaseAPI *handle, PIX *pix, int page_index, const char *filename, const char *retry_config, int timeout_millisec)
TESS_API TessResultIterator *TESS_CALL | TessBaseAPIGetIterator (TessBaseAPI *handle)
TESS_API TessMutableIterator *TESS_CALL | TessBaseAPIGetMutableIterator (TessBaseAPI *handle)
TESS_API char *TESS_CALL | TessBaseAPIGetUTF8Text (TessBaseAPI *handle)
TESS_API char *TESS_CALL | TessBaseAPIGetHOCRText (TessBaseAPI *handle, int page_number)
TESS_API char *TESS_CALL | TessBaseAPIGetBoxText (TessBaseAPI *handle, int page_number)
TESS_API char *TESS_CALL | TessBaseAPIGetUNLVText (TessBaseAPI *handle)
TESS_API int TESS_CALL | TessBaseAPIMeanTextConf (TessBaseAPI *handle)
TESS_API int *TESS_CALL | TessBaseAPIAllWordConfidences (TessBaseAPI *handle)
TESS_API BOOL TESS_CALL | TessBaseAPIAdaptToWordStr (TessBaseAPI *handle, TessPageSegMode mode, const char *wordstr)
TESS_API void TESS_CALL | TessBaseAPIClear (TessBaseAPI *handle)
TESS_API void TESS_CALL | TessBaseAPIEnd (TessBaseAPI *handle)
TESS_API int TESS_CALL | TessBaseAPIIsValidWord (TessBaseAPI *handle, const char *word)
TESS_API BOOL TESS_CALL | TessBaseAPIGetTextDirection (TessBaseAPI *handle, int *out_offset, float *out_slope)
TESS_API const char *TESS_CALL | TessBaseAPIGetUnichar (TessBaseAPI *handle, int unichar_id)
TESS_API void TESS_CALL | TessBaseAPISetMinOrientationMargin (TessBaseAPI *handle, double margin)
TESS_API void TESS_CALL | TessPageIteratorDelete (TessPageIterator *handle)
TESS_API TessPageIterator *TESS_CALL | TessPageIteratorCopy (const TessPageIterator *handle)
TESS_API void TESS_CALL | TessPageIteratorBegin (TessPageIterator *handle)
TESS_API BOOL TESS_CALL | TessPageIteratorNext (TessPageIterator *handle, TessPageIteratorLevel level)
TESS_API BOOL TESS_CALL | TessPageIteratorIsAtBeginningOf (const TessPageIterator *handle, TessPageIteratorLevel level)
TESS_API BOOL TESS_CALL | TessPageIteratorIsAtFinalElement (const TessPageIterator *handle, TessPageIteratorLevel level, TessPageIteratorLevel element)
TESS_API BOOL TESS_CALL | TessPageIteratorBoundingBox (const TessPageIterator *handle, TessPageIteratorLevel level, int *left, int *top, int *right, int *bottom)
TESS_API TessPolyBlockType TESS_CALL | TessPageIteratorBlockType (const TessPageIterator *handle)
TESS_API PIX *TESS_CALL | TessPageIteratorGetBinaryImage (const TessPageIterator *handle, TessPageIteratorLevel level)
TESS_API PIX *TESS_CALL | TessPageIteratorGetImage (const TessPageIterator *handle, TessPageIteratorLevel level, int padding, int *left, int *top)
TESS_API BOOL TESS_CALL | TessPageIteratorBaseline (const TessPageIterator *handle, TessPageIteratorLevel level, int *x1, int *y1, int *x2, int *y2)
TESS_API void TESS_CALL | TessPageIteratorOrientation (TessPageIterator *handle, TessOrientation *orientation, TessWritingDirection *writing_direction, TessTextlineOrder *textline_order, float *deskew_angle)
TESS_API void TESS_CALL | TessResultIteratorDelete (TessResultIterator *handle)
TESS_API TessResultIterator *TESS_CALL | TessResultIteratorCopy (const TessResultIterator *handle)
TESS_API TessPageIterator *TESS_CALL | TessResultIteratorGetPageIterator (TessResultIterator *handle)
TESS_API const TessPageIterator *TESS_CALL | TessResultIteratorGetPageIteratorConst (const TessResultIterator *handle)
TESS_API char *TESS_CALL | TessResultIteratorGetUTF8Text (const TessResultIterator *handle, TessPageIteratorLevel level)
TESS_API float TESS_CALL | TessResultIteratorConfidence (const TessResultIterator *handle, TessPageIteratorLevel level)
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)
TESS_API BOOL TESS_CALL | TessResultIteratorWordIsFromDictionary (const TessResultIterator *handle)
TESS_API BOOL TESS_CALL | TessResultIteratorWordIsNumeric (const TessResultIterator *handle)
TESS_API BOOL TESS_CALL | TessResultIteratorSymbolIsSuperscript (const TessResultIterator *handle)
TESS_API BOOL TESS_CALL | TessResultIteratorSymbolIsSubscript (const TessResultIterator *handle)
TESS_API BOOL TESS_CALL | TessResultIteratorSymbolIsDropcap (const TessResultIterator *handle)

## Macro Definition Documentation

#define BOOL int

Definition at line 26 of file capi.h.

#define FALSE 0

Definition at line 28 of file capi.h.

#define TESS_CALL

Definition at line 21 of file capi.h.

#define TRUE 1

Definition at line 27 of file capi.h.

## Typedef Documentation

typedef struct Boxa BOXA

Definition at line 70 of file capi.h.

typedef struct ETEXT_DESC ETEXT_DESC

Definition at line 68 of file capi.h.

typedef struct Pix PIX

Definition at line 69 of file capi.h.

typedef struct Pixa PIXA

Definition at line 71 of file capi.h.

typedef struct TessBaseAPI TessBaseAPI

Definition at line 54 of file capi.h.

typedef struct TessMutableIterator TessMutableIterator

Definition at line 57 of file capi.h.

typedef enum TessOcrEngineMode TessOcrEngineMode

typedef enum TessOrientation TessOrientation

typedef struct TessPageIterator TessPageIterator

Definition at line 55 of file capi.h.

typedef enum TessPageIteratorLevel TessPageIteratorLevel

typedef enum TessPageSegMode TessPageSegMode

typedef enum TessPolyBlockType TessPolyBlockType

typedef struct TessResultIterator TessResultIterator

Definition at line 56 of file capi.h.

typedef enum TessTextlineOrder TessTextlineOrder

typedef enum TessWritingDirection TessWritingDirection

## Enumeration Type Documentation

enum TessOcrEngineMode

Enumerator:

  OEM_TESSERACT_ONLY |
  OEM_CUBE_ONLY |
  OEM_TESSERACT_CUBE_COMBINED |
  OEM_DEFAULT |

Definition at line 58 of file capi.h.

{ OEM_TESSERACT_ONLY, OEM_CUBE_ONLY, OEM_TESSERACT_CUBE_COMBINED, OEM_DEFAULT } TessOcrEngineMode;

enum TessOrientation

Enumerator:

  ORIENTATION_PAGE_UP |
  ORIENTATION_PAGE_RIGHT |
  ORIENTATION_PAGE_DOWN |
  ORIENTATION_PAGE_LEFT |

Definition at line 65 of file capi.h.

{ ORIENTATION_PAGE_UP, ORIENTATION_PAGE_RIGHT, ORIENTATION_PAGE_DOWN, ORIENTATION_PAGE_LEFT } TessOrientation;

enum TessPageIteratorLevel

Enumerator:

  RIL_BLOCK |
  RIL_PARA |
  RIL_TEXTLINE |
  RIL_WORD |
  RIL_SYMBOL |

Definition at line 61 of file capi.h.

{ RIL_BLOCK, RIL_PARA, RIL_TEXTLINE, RIL_WORD, RIL_SYMBOL} TessPageIteratorLevel;

enum TessPageSegMode

Enumerator:

  PSM_OSD_ONLY |
  PSM_AUTO_OSD |
  PSM_AUTO_ONLY |
  PSM_AUTO |
  PSM_SINGLE_COLUMN |
  PSM_SINGLE_BLOCK_VERT_TEXT |
  PSM_SINGLE_BLOCK |
  PSM_SINGLE_LINE |
  PSM_SINGLE_WORD |
  PSM_CIRCLE_WORD |
  PSM_SINGLE_CHAR |
  PSM_COUNT |

Definition at line 59 of file capi.h.

{ PSM_OSD_ONLY, PSM_AUTO_OSD, PSM_AUTO_ONLY, PSM_AUTO, PSM_SINGLE_COLUMN, PSM_SINGLE_BLOCK_VERT_TEXT,
PSM_SINGLE_BLOCK, PSM_SINGLE_LINE, PSM_SINGLE_WORD, PSM_CIRCLE_WORD, PSM_SINGLE_CHAR, PSM_COUNT } TessPageSegMode;

enum TessPolyBlockType

Enumerator:

  PT_UNKNOWN |
  PT_FLOWING_TEXT |
  PT_HEADING_TEXT |
  PT_PULLOUT_TEXT |
  PT_TABLE |
  PT_VERTICAL_TEXT |
  PT_CAPTION_TEXT |
  PT_FLOWING_IMAGE |
  PT_HEADING_IMAGE |
  PT_PULLOUT_IMAGE |
  PT_HORZ_LINE |
  PT_VERT_LINE |
  PT_NOISE |
  PT_COUNT |

Definition at line 62 of file capi.h.

{ PT_UNKNOWN, PT_FLOWING_TEXT, PT_HEADING_TEXT, PT_PULLOUT_TEXT, PT_TABLE, PT_VERTICAL_TEXT,
PT_CAPTION_TEXT, PT_FLOWING_IMAGE, PT_HEADING_IMAGE, PT_PULLOUT_IMAGE, PT_HORZ_LINE, PT_VERT_LINE,
PT_NOISE, PT_COUNT } TessPolyBlockType;

enum TessTextlineOrder

Enumerator:

  TEXTLINE_ORDER_LEFT_TO_RIGHT |
  TEXTLINE_ORDER_RIGHT_TO_LEFT |
  TEXTLINE_ORDER_TOP_TO_BOTTOM |

Definition at line 67 of file capi.h.

{ TEXTLINE_ORDER_LEFT_TO_RIGHT, TEXTLINE_ORDER_RIGHT_TO_LEFT, TEXTLINE_ORDER_TOP_TO_BOTTOM } TessTextlineOrder;

enum TessWritingDirection

Enumerator:

  WRITING_DIRECTION_LEFT_TO_RIGHT |
  WRITING_DIRECTION_RIGHT_TO_LEFT |
  WRITING_DIRECTION_TOP_TO_BOTTOM |

Definition at line 66 of file capi.h.

{ WRITING_DIRECTION_LEFT_TO_RIGHT, WRITING_DIRECTION_RIGHT_TO_LEFT, WRITING_DIRECTION_TOP_TO_BOTTOM } TessWritingDirection;

## Function Documentation

TESS_API BOOL TESS_CALL TessBaseAPIAdaptToWordStr | ( | TessBaseAPI * | handle,
|  | TessPageSegMode | mode,
|  | const char * | wordstr
| ) |  |

Definition at line 345 of file capi.cpp.

{
return handle->AdaptToWordStr(mode, wordstr) ? TRUE : FALSE;
}

TESS_API int* TESS_CALL TessBaseAPIAllWordConfidences | ( | TessBaseAPI * | handle | ) |

Definition at line 340 of file capi.cpp.

{
return handle->AllWordConfidences();
}

TESS_API TessPageIterator* TESS_CALL TessBaseAPIAnalyseLayout | ( | TessBaseAPI * | handle | ) |

Definition at line 270 of file capi.cpp.

{
return handle->AnalyseLayout();
}

TESS_API void TESS_CALL TessBaseAPIClear | ( | TessBaseAPI * | handle | ) |

Definition at line 350 of file capi.cpp.

{
handle->Clear();
}

TESS_API void TESS_CALL TessBaseAPIClearAdaptiveClassifier | ( | TessBaseAPI * | handle | ) |

Definition at line 194 of file capi.cpp.

{
handle->ClearAdaptiveClassifier();
}

TESS_API TessBaseAPI* TESS_CALL TessBaseAPICreate | ( |  | ) |

Definition at line 33 of file capi.cpp.

{
return new TessBaseAPI;
}

TESS_API void TESS_CALL TessBaseAPIDelete | ( | TessBaseAPI * | handle | ) |

Definition at line 38 of file capi.cpp.

{
delete handle;
}

TESS_API void TESS_CALL TessBaseAPIDumpPGM | ( | TessBaseAPI * | handle,
|  | const char * | filename
| ) |  |

Definition at line 265 of file capi.cpp.

{
handle->DumpPGM(filename);
}

TESS_API void TESS_CALL TessBaseAPIEnd | ( | TessBaseAPI * | handle | ) |

Definition at line 355 of file capi.cpp.

{
handle->End();
}

TESS_API char** TESS_CALL TessBaseAPIGetAvailableLanguagesAsVector | ( | const TessBaseAPI * | handle | ) |

Definition at line 146 of file capi.cpp.

{
GenericVector<STRING> languages;
handle->GetAvailableLanguagesAsVector(&languages);
char** arr = new char*[languages.size() + 1];
for (int index = 0; index < languages.size(); ++index)
arr[index] = languages[index].strdup();
arr[languages.size()] = NULL;
return arr;
}

TESS_API BOOL TESS_CALL TessBaseAPIGetBoolVariable | ( | const TessBaseAPI * | handle,
|  | const char * | name,
|  | BOOL * | value
| ) |  |

Definition at line 68 of file capi.cpp.

{
bool boolValue;
if (handle->GetBoolVariable(name, &boolValue))
{
*value = boolValue ? TRUE : FALSE;
return TRUE;
}
else
{
return FALSE;
}
}

TESS_API char* TESS_CALL TessBaseAPIGetBoxText | ( | TessBaseAPI * | handle,
|  | int | page_number
| ) |  |

Definition at line 325 of file capi.cpp.

{
return handle->GetBoxText(page_number);
}

TESS_API BOXA* TESS_CALL TessBaseAPIGetComponentImages | ( | TessBaseAPI * | handle,
|  | TessPageIteratorLevel | level,
|  | BOOL | text_only,
|  | PIXA ** | pixa,
|  | int ** | blockids
| ) |  |

TESS_API BOXA* TESS_CALL TessBaseAPIGetConnectedComponents | ( | TessBaseAPI * | handle,
|  | PIXA ** | cc
| ) |  |

TESS_API BOOL TESS_CALL TessBaseAPIGetDoubleVariable | ( | const TessBaseAPI * | handle,
|  | const char * | name,
|  | double * | value
| ) |  |

Definition at line 82 of file capi.cpp.

{
return handle->GetDoubleVariable(name, value) ? TRUE : FALSE;
}

TESS_API char* TESS_CALL TessBaseAPIGetHOCRText | ( | TessBaseAPI * | handle,
|  | int | page_number
| ) |  |

Definition at line 320 of file capi.cpp.

{
return handle->GetHOCRText(page_number);
}

TESS_API const char* TESS_CALL TessBaseAPIGetInitLanguagesAsString | ( | const TessBaseAPI * | handle | ) |

Definition at line 130 of file capi.cpp.

{
return handle->GetInitLanguagesAsString();
}

TESS_API BOOL TESS_CALL TessBaseAPIGetIntVariable | ( | const TessBaseAPI * | handle,
|  | const char * | name,
|  | int * | value
| ) |  |

Definition at line 63 of file capi.cpp.

{
return handle->GetIntVariable(name, value) ? TRUE : FALSE;
}

TESS_API TessResultIterator* TESS_CALL TessBaseAPIGetIterator | ( | TessBaseAPI * | handle | ) |

Definition at line 305 of file capi.cpp.

{
return handle->GetIterator();
}

TESS_API char** TESS_CALL TessBaseAPIGetLoadedLanguagesAsVector | ( | const TessBaseAPI * | handle | ) |

Definition at line 135 of file capi.cpp.

{
GenericVector<STRING> languages;
handle->GetLoadedLanguagesAsVector(&languages);
char** arr = new char*[languages.size() + 1];
for (int index = 0; index < languages.size(); ++index)
arr[index] = languages[index].strdup();
arr[languages.size()] = NULL;
return arr;
}

TESS_API TessMutableIterator* TESS_CALL TessBaseAPIGetMutableIterator | ( | TessBaseAPI * | handle | ) |

Definition at line 310 of file capi.cpp.

{
return handle->GetMutableIterator();
}

TESS_API TessPageSegMode TESS_CALL TessBaseAPIGetPageSegMode | ( | const TessBaseAPI * | handle | ) |

Definition at line 182 of file capi.cpp.

{
return handle->GetPageSegMode();
}

TESS_API BOXA* TESS_CALL TessBaseAPIGetRegions | ( | TessBaseAPI * | handle,
|  | PIXA ** | pixa
| ) |  |

TESS_API const char* TESS_CALL TessBaseAPIGetStringVariable | ( | const TessBaseAPI * | handle,
|  | const char * | name
| ) |  |

Definition at line 87 of file capi.cpp.

{
return handle->GetStringVariable(name);
}

TESS_API BOXA* TESS_CALL TessBaseAPIGetStrips | ( | TessBaseAPI * | handle,
|  | PIXA ** | pixa,
|  | int ** | blockids
| ) |  |

Definition at line 240 of file capi.cpp.

{
return handle->GetStrips(pixa, blockids);
}

TESS_API BOOL TESS_CALL TessBaseAPIGetTextDirection | ( | TessBaseAPI * | handle,
|  | int * | out_offset,
|  | float * | out_slope
| ) |  |

Definition at line 365 of file capi.cpp.

{
return handle->GetTextDirection(out_offset, out_slope) ? TRUE : FALSE;
}

TESS_API BOXA* TESS_CALL TessBaseAPIGetTextlines | ( | TessBaseAPI * | handle,
|  | PIXA ** | pixa,
|  | int ** | blockids
| ) |  |

TESS_API PIX* TESS_CALL TessBaseAPIGetThresholdedImage | ( | TessBaseAPI * | handle | ) |

Definition at line 225 of file capi.cpp.

{
return handle->GetThresholdedImage();
}

TESS_API int TESS_CALL TessBaseAPIGetThresholdedImageScaleFactor | ( | const TessBaseAPI * | handle | ) |

Definition at line 260 of file capi.cpp.

{
return handle->GetThresholdedImageScaleFactor();
}

TESS_API const char* TESS_CALL TessBaseAPIGetUnichar | ( | TessBaseAPI * | handle,
|  | int | unichar_id
| ) |  |

Definition at line 402 of file capi.cpp.

{
return handle->GetUnichar(unichar_id);
}

TESS_API char* TESS_CALL TessBaseAPIGetUNLVText | ( | TessBaseAPI * | handle | ) |

Definition at line 330 of file capi.cpp.

{
return handle->GetUNLVText();
}

TESS_API char* TESS_CALL TessBaseAPIGetUTF8Text | ( | TessBaseAPI * | handle | ) |

Definition at line 315 of file capi.cpp.

{
return handle->GetUTF8Text();
}

TESS_API BOXA* TESS_CALL TessBaseAPIGetWords | ( | TessBaseAPI * | handle,
|  | PIXA ** | pixa
| ) |  |

TESS_API int TESS_CALL TessBaseAPIInit1 | ( | TessBaseAPI * | handle,
|  | const char * | datapath,
|  | const char * | language,
|  | TessOcrEngineMode | oem,
|  | char ** | configs,
|  | int | configs_size
| ) |  |

Definition at line 114 of file capi.cpp.

{
return handle->Init(datapath, language, oem, configs, configs_size, NULL, NULL, false);
}

TESS_API int TESS_CALL TessBaseAPIInit2 | ( | TessBaseAPI * | handle,
|  | const char * | datapath,
|  | const char * | language,
|  | TessOcrEngineMode | oem
| ) |  |

Definition at line 120 of file capi.cpp.

{
return handle->Init(datapath, language, oem);
}

TESS_API int TESS_CALL TessBaseAPIInit3 | ( | TessBaseAPI * | handle,
|  | const char * | datapath,
|  | const char * | language
| ) |  |

Definition at line 125 of file capi.cpp.

{
return handle->Init(datapath, language);
}

TESS_API void TESS_CALL TessBaseAPIInitForAnalysePage | ( | TessBaseAPI * | handle | ) |

Definition at line 162 of file capi.cpp.

{
handle->InitForAnalysePage();
}

TESS_API int TESS_CALL TessBaseAPIInitLangMod | ( | TessBaseAPI * | handle,
|  | const char * | datapath,
|  | const char * | language
| ) |  |

Definition at line 157 of file capi.cpp.

{
return handle->InitLangMod(datapath, language);
}

TESS_API int TESS_CALL TessBaseAPIIsValidWord | ( | TessBaseAPI * | handle,
|  | const char * | word
| ) |  |

Definition at line 360 of file capi.cpp.

{
return handle->IsValidWord(word);
}

TESS_API int TESS_CALL TessBaseAPIMeanTextConf | ( | TessBaseAPI * | handle | ) |

Definition at line 335 of file capi.cpp.

{
return handle->MeanTextConf();
}

TESS_API void TESS_CALL TessBaseAPIPrintVariables | ( | const TessBaseAPI * | handle,
|  | FILE * | fp
| ) |  |

Definition at line 92 of file capi.cpp.

{
handle->PrintVariables(fp);
}

TESS_API BOOL TESS_CALL TessBaseAPIPrintVariablesToFile | ( | const TessBaseAPI * | handle,
|  | const char * | filename
| ) |  |

Definition at line 97 of file capi.cpp.

{
FILE* fp = fopen(filename, "w");
if (fp != NULL)
{
handle->PrintVariables(fp);
fclose(fp);
return TRUE;
}
return FALSE;
}

TESS_API char* TESS_CALL TessBaseAPIProcessPage | ( | TessBaseAPI * | handle,
|  | PIX * | pix,
|  | int | page_index,
|  | const char * | filename,
|  | const char * | retry_config,
|  | int | timeout_millisec
| ) |  |

TESS_API char* TESS_CALL TessBaseAPIProcessPages | ( | TessBaseAPI * | handle,
|  | const char * | filename,
|  | const char * | retry_config,
|  | int | timeout_millisec
| ) |  |

Definition at line 285 of file capi.cpp.

{
STRING text_out;
if (handle->ProcessPages(filename, retry_config, timeout_millisec, &text_out))
return text_out.strdup();
else
return NULL;
}

TESS_API void TESS_CALL TessBaseAPIReadConfigFile | ( | TessBaseAPI * | handle,
|  | const char * | filename
| ) |  |

Definition at line 167 of file capi.cpp.

{
handle->ReadConfigFile(filename);
}

TESS_API void TESS_CALL TessBaseAPIReadDebugConfigFile | ( | TessBaseAPI * | handle,
|  | const char * | filename
| ) |  |

Definition at line 172 of file capi.cpp.

{
handle->ReadDebugConfigFile(filename);
}

TESS_API int TESS_CALL TessBaseAPIRecognize | ( | TessBaseAPI * | handle,
|  | ETEXT_DESC * | monitor
| ) |  |

Definition at line 275 of file capi.cpp.

{
return handle->Recognize(monitor);
}

TESS_API int TESS_CALL TessBaseAPIRecognizeForChopTest | ( | TessBaseAPI * | handle,
|  | ETEXT_DESC * | monitor
| ) |  |

Definition at line 280 of file capi.cpp.

{
return handle->RecognizeForChopTest(monitor);
}

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 at line 187 of file capi.cpp.

{
return handle->TesseractRect(imagedata, bytes_per_pixel, bytes_per_line, left, top, width, height);
}

TESS_API BOOL TESS_CALL TessBaseAPISetDebugVariable | ( | TessBaseAPI * | handle,
|  | const char * | name,
|  | const char * | value
| ) |  |

Definition at line 58 of file capi.cpp.

{
return handle->SetVariable(name, value) ? TRUE : FALSE;
}

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 at line 199 of file capi.cpp.

{
handle->SetImage(imagedata, width, height, bytes_per_pixel, bytes_per_line);
}

TESS_API void TESS_CALL TessBaseAPISetImage2 | ( | TessBaseAPI * | handle,
|  | const PIX * | pix
| ) |  |

TESS_API void TESS_CALL TessBaseAPISetInputName | ( | TessBaseAPI * | handle,
|  | const char * | name
| ) |  |

Definition at line 43 of file capi.cpp.

{
handle->SetInputName(name);
}

TESS_API void TESS_CALL TessBaseAPISetMinOrientationMargin | ( | TessBaseAPI * | handle,
|  | double | margin
| ) |  |

Definition at line 447 of file capi.cpp.

{
handle->set_min_orientation_margin(margin);
}

TESS_API void TESS_CALL TessBaseAPISetOutputName | ( | TessBaseAPI * | handle,
|  | const char * | name
| ) |  |

Definition at line 48 of file capi.cpp.

{
handle->SetOutputName(name);
}

TESS_API void TESS_CALL TessBaseAPISetPageSegMode | ( | TessBaseAPI * | handle,
|  | TessPageSegMode | mode
| ) |  |

Definition at line 177 of file capi.cpp.

{
handle->SetPageSegMode(mode);
}

TESS_API void TESS_CALL TessBaseAPISetRectangle | ( | TessBaseAPI * | handle,
|  | int | left,
|  | int | top,
|  | int | width,
|  | int | height
| ) |  |

Definition at line 215 of file capi.cpp.

{
handle->SetRectangle(left, top, width, height);
}

TESS_API void TESS_CALL TessBaseAPISetSourceResolution | ( | TessBaseAPI * | handle,
|  | int | ppi
| ) |  |

Definition at line 210 of file capi.cpp.

{
handle->SetSourceResolution(ppi);
}

TESS_API BOOL TESS_CALL TessBaseAPISetVariable | ( | TessBaseAPI * | handle,
|  | const char * | name,
|  | const char * | value
| ) |  |

Definition at line 53 of file capi.cpp.

{
return handle->SetVariable(name, value) ? TRUE : FALSE;
}

TESS_API void TESS_CALL TessDeleteIntArray | ( | int * | arr | ) |

Definition at line 23 of file capi.cpp.

{
delete [] arr;
}

TESS_API void TESS_CALL TessDeleteText | ( | char * | text | ) |

Definition at line 11 of file capi.cpp.

{
delete [] text;
}

TESS_API void TESS_CALL TessDeleteTextArray | ( | char ** | arr | ) |

Definition at line 16 of file capi.cpp.

{
for (char** pos = arr; *pos != NULL; ++pos)
delete [] *pos;
delete [] arr;
}

TESS_API BOOL TESS_CALL TessPageIteratorBaseline | ( | const TessPageIterator * | handle,
|  | TessPageIteratorLevel | level,
|  | int * | x1,
|  | int * | y1,
|  | int * | x2,
|  | int * | y2
| ) |  |

Definition at line 515 of file capi.cpp.

{
return handle->Baseline(level, x1, y1, x2, y2) ? TRUE : FALSE;
}

TESS_API void TESS_CALL TessPageIteratorBegin | ( | TessPageIterator * | handle | ) |

Definition at line 472 of file capi.cpp.

{
handle->Begin();
}

TESS_API TessPolyBlockType TESS_CALL TessPageIteratorBlockType | ( | const TessPageIterator * | handle | ) |

Definition at line 499 of file capi.cpp.

{
return handle->BlockType();
}

TESS_API BOOL TESS_CALL TessPageIteratorBoundingBox | ( | const TessPageIterator * | handle,
|  | TessPageIteratorLevel | level,
|  | int * | left,
|  | int * | top,
|  | int * | right,
|  | int * | bottom
| ) |  |

Definition at line 493 of file capi.cpp.

{
return handle->BoundingBox(level, left, top, right, bottom) ? TRUE : FALSE;
}

TESS_API TessPageIterator* TESS_CALL TessPageIteratorCopy | ( | const TessPageIterator * | handle | ) |

Definition at line 467 of file capi.cpp.

{
return new TessPageIterator(*handle);
}

TESS_API void TESS_CALL TessPageIteratorDelete | ( | TessPageIterator * | handle | ) |

Definition at line 462 of file capi.cpp.

{
delete handle;
}

TESS_API PIX* TESS_CALL TessPageIteratorGetBinaryImage | ( | const TessPageIterator * | handle,
|  | TessPageIteratorLevel | level
| ) |  |

Definition at line 504 of file capi.cpp.

{
return handle->GetBinaryImage(level);
}

TESS_API PIX* TESS_CALL TessPageIteratorGetImage | ( | const TessPageIterator * | handle,
|  | TessPageIteratorLevel | level,
|  | int | padding,
|  | int * | left,
|  | int * | top
| ) |  |

Definition at line 509 of file capi.cpp.

{
return handle->GetImage(level, padding, left, top);
}

TESS_API BOOL TESS_CALL TessPageIteratorIsAtBeginningOf | ( | const TessPageIterator * | handle,
|  | TessPageIteratorLevel | level
| ) |  |

Definition at line 482 of file capi.cpp.

{
return handle->IsAtBeginningOf(level) ? TRUE : FALSE;
}

TESS_API BOOL TESS_CALL TessPageIteratorIsAtFinalElement | ( | const TessPageIterator * | handle,
|  | TessPageIteratorLevel | level,
|  | TessPageIteratorLevel | element
| ) |  |

Definition at line 487 of file capi.cpp.

{
return handle->IsAtFinalElement(level, element) ? TRUE : FALSE;
}

TESS_API BOOL TESS_CALL TessPageIteratorNext | ( | TessPageIterator * | handle,
|  | TessPageIteratorLevel | level
| ) |  |

Definition at line 477 of file capi.cpp.

{
return handle->Next(level) ? TRUE : FALSE;
}

TESS_API void TESS_CALL TessPageIteratorOrientation | ( | TessPageIterator * | handle,
|  | TessOrientation * | orientation,
|  | TessWritingDirection * | writing_direction,
|  | TessTextlineOrder * | textline_order,
|  | float * | deskew_angle
| ) |  |

Definition at line 521 of file capi.cpp.

{
handle->Orientation(orientation, writing_direction, textline_order, deskew_angle);
}

TESS_API float TESS_CALL TessResultIteratorConfidence | ( | const TessResultIterator * | handle,
|  | TessPageIteratorLevel | level
| ) |  |

Definition at line 553 of file capi.cpp.

{
return handle->Confidence(level);
}

TESS_API TessResultIterator* TESS_CALL TessResultIteratorCopy | ( | const TessResultIterator * | handle | ) |

Definition at line 533 of file capi.cpp.

{
return static_cast<TessResultIterator*>(new TessPageIterator(*handle));
}

TESS_API void TESS_CALL TessResultIteratorDelete | ( | TessResultIterator * | handle | ) |

Definition at line 528 of file capi.cpp.

{
delete handle;
}

TESS_API TessPageIterator* TESS_CALL TessResultIteratorGetPageIterator | ( | TessResultIterator * | handle | ) |

Definition at line 538 of file capi.cpp.

{
return handle;
}

TESS_API const TessPageIterator* TESS_CALL TessResultIteratorGetPageIteratorConst | ( | const TessResultIterator * | handle | ) |

Definition at line 543 of file capi.cpp.

{
return handle;
}

TESS_API char* TESS_CALL TessResultIteratorGetUTF8Text | ( | const TessResultIterator * | handle,
|  | TessPageIteratorLevel | level
| ) |  |

Definition at line 548 of file capi.cpp.

{
return handle->GetUTF8Text(level);
}

TESS_API BOOL TESS_CALL TessResultIteratorSymbolIsDropcap | ( | const TessResultIterator * | handle | ) |

Definition at line 600 of file capi.cpp.

{
return handle->SymbolIsDropcap() ? TRUE : FALSE;
}

TESS_API BOOL TESS_CALL TessResultIteratorSymbolIsSubscript | ( | const TessResultIterator * | handle | ) |

Definition at line 595 of file capi.cpp.

{
return handle->SymbolIsSubscript() ? TRUE : FALSE;
}

TESS_API BOOL TESS_CALL TessResultIteratorSymbolIsSuperscript | ( | const TessResultIterator * | handle | ) |

Definition at line 590 of file capi.cpp.

{
return handle->SymbolIsSuperscript() ? TRUE : FALSE;
}

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 at line 558 of file capi.cpp.

{
bool bool_is_bold, bool_is_italic, bool_is_underlined, bool_is_monospace, bool_is_serif, bool_is_smallcaps;
const char* ret = handle->WordFontAttributes(&bool_is_bold, &bool_is_italic, &bool_is_underlined, &bool_is_monospace, &bool_is_serif,
&bool_is_smallcaps, pointsize, font_id);
if (is_bold)
*is_bold = bool_is_bold ? TRUE : FALSE;
if (is_italic)
*is_italic = bool_is_italic ? TRUE : FALSE;
if (is_underlined)
*is_underlined = bool_is_underlined ? TRUE : FALSE;
if (is_monospace)
*is_monospace = bool_is_monospace ? TRUE : FALSE;
if (is_serif)
*is_serif = bool_is_serif ? TRUE : FALSE;
if (is_smallcaps)
*is_smallcaps = bool_is_smallcaps ? TRUE : FALSE;
return ret;
}

TESS_API BOOL TESS_CALL TessResultIteratorWordIsFromDictionary | ( | const TessResultIterator * | handle | ) |

Definition at line 580 of file capi.cpp.

{
return handle->WordIsFromDictionary() ? TRUE : FALSE;
}

TESS_API BOOL TESS_CALL TessResultIteratorWordIsNumeric | ( | const TessResultIterator * | handle | ) |

Definition at line 585 of file capi.cpp.

{
return handle->WordIsNumeric() ? TRUE : FALSE;
}

TESS_API const char* TESS_CALL TessVersion | ( |  | ) |

Definition at line 6 of file capi.cpp.

{
return TessBaseAPI::Version();
}