2016-03-19 02:17:09 +08:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
// File: capi.h
|
|
|
|
// Description: C-API TessBaseAPI
|
|
|
|
//
|
|
|
|
// (C) Copyright 2012, Google Inc.
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef API_CAPI_H_
|
|
|
|
#define API_CAPI_H_
|
2012-09-24 13:14:11 +08:00
|
|
|
|
|
|
|
#ifdef TESS_CAPI_INCLUDE_BASEAPI
|
|
|
|
# include "baseapi.h"
|
|
|
|
# include "pageiterator.h"
|
|
|
|
# include "resultiterator.h"
|
2014-02-03 07:50:47 +08:00
|
|
|
# include "renderer.h"
|
2012-09-24 13:14:11 +08:00
|
|
|
#else
|
|
|
|
# include "platform.h"
|
|
|
|
# include <stdio.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
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
|
|
|
|
# define FALSE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TESS_CAPI_INCLUDE_BASEAPI
|
2014-02-03 07:50:47 +08:00
|
|
|
typedef tesseract::TessResultRenderer TessResultRenderer;
|
|
|
|
typedef tesseract::TessTextRenderer TessTextRenderer;
|
|
|
|
typedef tesseract::TessHOcrRenderer TessHOcrRenderer;
|
|
|
|
typedef tesseract::TessPDFRenderer TessPDFRenderer;
|
|
|
|
typedef tesseract::TessUnlvRenderer TessUnlvRenderer;
|
|
|
|
typedef tesseract::TessBoxTextRenderer TessBoxTextRenderer;
|
2012-09-24 13:14:11 +08:00
|
|
|
typedef tesseract::TessBaseAPI TessBaseAPI;
|
|
|
|
typedef tesseract::PageIterator TessPageIterator;
|
|
|
|
typedef tesseract::ResultIterator TessResultIterator;
|
|
|
|
typedef tesseract::MutableIterator TessMutableIterator;
|
2014-05-03 17:29:20 +08:00
|
|
|
typedef tesseract::ChoiceIterator TessChoiceIterator;
|
2012-09-24 13:14:11 +08:00
|
|
|
typedef tesseract::OcrEngineMode TessOcrEngineMode;
|
|
|
|
typedef tesseract::PageSegMode TessPageSegMode;
|
|
|
|
typedef tesseract::ImageThresholder TessImageThresholder;
|
|
|
|
typedef tesseract::PageIteratorLevel TessPageIteratorLevel;
|
|
|
|
typedef tesseract::DictFunc TessDictFunc;
|
|
|
|
typedef tesseract::ProbabilityInContextFunc TessProbabilityInContextFunc;
|
2014-02-03 21:24:55 +08:00
|
|
|
// typedef tesseract::ParamsModelClassifyFunc TessParamsModelClassifyFunc;
|
2012-09-24 13:14:11 +08:00
|
|
|
typedef tesseract::FillLatticeFunc TessFillLatticeFunc;
|
|
|
|
typedef tesseract::Dawg TessDawg;
|
|
|
|
typedef tesseract::TruthCallback TessTruthCallback;
|
|
|
|
typedef tesseract::Orientation TessOrientation;
|
2014-12-07 21:07:14 +08:00
|
|
|
typedef tesseract::ParagraphJustification TessParagraphJustification;
|
2012-09-24 13:14:11 +08:00
|
|
|
typedef tesseract::WritingDirection TessWritingDirection;
|
|
|
|
typedef tesseract::TextlineOrder TessTextlineOrder;
|
|
|
|
typedef PolyBlockType TessPolyBlockType;
|
|
|
|
#else
|
2014-02-03 07:50:47 +08:00
|
|
|
typedef struct TessResultRenderer TessResultRenderer;
|
|
|
|
typedef struct TessTextRenderer TessTextRenderer;
|
|
|
|
typedef struct TessHOcrRenderer TessHOcrRenderer;
|
|
|
|
typedef struct TessPDFRenderer TessPDFRenderer;
|
|
|
|
typedef struct TessUnlvRenderer TessUnlvRenderer;
|
|
|
|
typedef struct TessBoxTextRenderer TessBoxTextRenderer;
|
2012-09-24 13:14:11 +08:00
|
|
|
typedef struct TessBaseAPI TessBaseAPI;
|
|
|
|
typedef struct TessPageIterator TessPageIterator;
|
|
|
|
typedef struct TessResultIterator TessResultIterator;
|
|
|
|
typedef struct TessMutableIterator TessMutableIterator;
|
2014-05-08 04:53:03 +08:00
|
|
|
typedef struct TessChoiceIterator TessChoiceIterator;
|
2016-12-15 03:35:46 +08:00
|
|
|
typedef enum TessOcrEngineMode { OEM_TESSERACT_ONLY, OEM_LSTM_ONLY, OEM_TESSERACT_LSTM_COMBINED, OEM_DEFAULT } TessOcrEngineMode;
|
2012-09-24 13:14:11 +08:00
|
|
|
typedef enum TessPageSegMode { PSM_OSD_ONLY, PSM_AUTO_OSD, PSM_AUTO_ONLY, PSM_AUTO, PSM_SINGLE_COLUMN, PSM_SINGLE_BLOCK_VERT_TEXT,
|
2013-04-30 01:57:21 +08:00
|
|
|
PSM_SINGLE_BLOCK, PSM_SINGLE_LINE, PSM_SINGLE_WORD, PSM_CIRCLE_WORD, PSM_SINGLE_CHAR, PSM_SPARSE_TEXT,
|
|
|
|
PSM_SPARSE_TEXT_OSD, PSM_COUNT } TessPageSegMode;
|
2012-09-24 13:14:11 +08:00
|
|
|
typedef enum TessPageIteratorLevel { RIL_BLOCK, RIL_PARA, RIL_TEXTLINE, RIL_WORD, RIL_SYMBOL} TessPageIteratorLevel;
|
2014-06-01 04:31:48 +08:00
|
|
|
typedef enum TessPolyBlockType { PT_UNKNOWN, PT_FLOWING_TEXT, PT_HEADING_TEXT, PT_PULLOUT_TEXT, PT_EQUATION, PT_INLINE_EQUATION,
|
|
|
|
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;
|
2012-09-24 13:14:11 +08:00
|
|
|
typedef enum TessOrientation { ORIENTATION_PAGE_UP, ORIENTATION_PAGE_RIGHT, ORIENTATION_PAGE_DOWN, ORIENTATION_PAGE_LEFT } TessOrientation;
|
2014-12-07 21:07:14 +08:00
|
|
|
typedef enum TessParagraphJustification { JUSTIFICATION_UNKNOWN, JUSTIFICATION_LEFT, JUSTIFICATION_CENTER, JUSTIFICATION_RIGHT } TessParagraphJustification;
|
2012-09-24 13:14:11 +08:00
|
|
|
typedef enum TessWritingDirection { WRITING_DIRECTION_LEFT_TO_RIGHT, WRITING_DIRECTION_RIGHT_TO_LEFT, WRITING_DIRECTION_TOP_TO_BOTTOM } TessWritingDirection;
|
|
|
|
typedef enum TessTextlineOrder { TEXTLINE_ORDER_LEFT_TO_RIGHT, TEXTLINE_ORDER_RIGHT_TO_LEFT, TEXTLINE_ORDER_TOP_TO_BOTTOM } TessTextlineOrder;
|
|
|
|
typedef struct ETEXT_DESC ETEXT_DESC;
|
|
|
|
#endif
|
|
|
|
|
2013-04-30 01:57:21 +08:00
|
|
|
struct Pix;
|
|
|
|
struct Boxa;
|
|
|
|
struct Pixa;
|
|
|
|
|
2012-09-24 13:14:11 +08:00
|
|
|
/* General free 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);
|
|
|
|
#ifdef TESS_CAPI_INCLUDE_BASEAPI
|
|
|
|
TESS_API void TESS_CALL TessDeleteBlockList(BLOCK_LIST* block_list);
|
|
|
|
#endif
|
|
|
|
|
2014-02-03 07:50:47 +08:00
|
|
|
/* Renderer API */
|
2014-05-26 05:03:11 +08:00
|
|
|
TESS_API TessResultRenderer* TESS_CALL TessTextRendererCreate(const char* outputbase);
|
|
|
|
TESS_API TessResultRenderer* TESS_CALL TessHOcrRendererCreate(const char* outputbase);
|
2014-08-04 00:22:12 +08:00
|
|
|
TESS_API TessResultRenderer* TESS_CALL TessHOcrRendererCreate2(const char* outputbase, BOOL font_info);
|
2017-01-21 14:40:54 +08:00
|
|
|
TESS_API TessResultRenderer* TESS_CALL TessPDFRendererCreate(const char* outputbase, const char* datadir,
|
2018-01-11 16:11:30 +08:00
|
|
|
BOOL textonly, int jpg_quality);
|
2014-05-26 05:03:11 +08:00
|
|
|
TESS_API TessResultRenderer* TESS_CALL TessUnlvRendererCreate(const char* outputbase);
|
|
|
|
TESS_API TessResultRenderer* TESS_CALL TessBoxTextRendererCreate(const char* outputbase);
|
2014-02-03 07:50:47 +08:00
|
|
|
|
|
|
|
TESS_API void TESS_CALL TessDeleteResultRenderer(TessResultRenderer* renderer);
|
|
|
|
TESS_API void TESS_CALL TessResultRendererInsert(TessResultRenderer* renderer, TessResultRenderer* next);
|
|
|
|
TESS_API TessResultRenderer*
|
|
|
|
TESS_CALL TessResultRendererNext(TessResultRenderer* renderer);
|
|
|
|
TESS_API BOOL TESS_CALL TessResultRendererBeginDocument(TessResultRenderer* renderer, const char* title);
|
|
|
|
TESS_API BOOL TESS_CALL TessResultRendererAddImage(TessResultRenderer* renderer, TessBaseAPI* api);
|
|
|
|
TESS_API BOOL TESS_CALL TessResultRendererEndDocument(TessResultRenderer* renderer);
|
|
|
|
|
|
|
|
TESS_API const char* TESS_CALL TessResultRendererExtention(TessResultRenderer* renderer);
|
|
|
|
TESS_API const char* TESS_CALL TessResultRendererTitle(TessResultRenderer* renderer);
|
|
|
|
TESS_API int TESS_CALL TessResultRendererImageNum(TessResultRenderer* renderer);
|
|
|
|
|
2012-09-24 13:14:11 +08:00
|
|
|
/* Base API */
|
|
|
|
|
|
|
|
TESS_API TessBaseAPI*
|
|
|
|
TESS_CALL TessBaseAPICreate();
|
|
|
|
TESS_API void TESS_CALL TessBaseAPIDelete(TessBaseAPI* handle);
|
|
|
|
|
2014-02-03 07:50:47 +08:00
|
|
|
TESS_API size_t TESS_CALL TessBaseAPIGetOpenCLDevice(TessBaseAPI* handle, void **device);
|
|
|
|
|
2012-09-24 13:14:11 +08:00
|
|
|
TESS_API void TESS_CALL TessBaseAPISetInputName( TessBaseAPI* handle, const char* name);
|
2014-02-03 07:50:47 +08:00
|
|
|
TESS_API const char* TESS_CALL TessBaseAPIGetInputName(TessBaseAPI* handle);
|
|
|
|
|
|
|
|
TESS_API void TESS_CALL TessBaseAPISetInputImage(TessBaseAPI* handle, struct Pix* pix);
|
|
|
|
TESS_API struct Pix* TESS_CALL TessBaseAPIGetInputImage(TessBaseAPI* handle);
|
|
|
|
|
|
|
|
TESS_API int TESS_CALL TessBaseAPIGetSourceYResolution(TessBaseAPI* handle);
|
|
|
|
TESS_API const char* TESS_CALL TessBaseAPIGetDatapath(TessBaseAPI* handle);
|
|
|
|
|
2012-09-24 13:14:11 +08:00
|
|
|
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);
|
|
|
|
#ifdef TESS_CAPI_INCLUDE_BASEAPI
|
|
|
|
TESS_API BOOL TESS_CALL TessBaseAPIGetVariableAsString(TessBaseAPI* handle, const char* name, STRING* val);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TESS_CAPI_INCLUDE_BASEAPI
|
|
|
|
TESS_API int TESS_CALL 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, size_t vars_values_size, BOOL set_only_init_params);
|
|
|
|
#endif
|
|
|
|
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);
|
|
|
|
|
2014-08-04 00:22:12 +08:00
|
|
|
TESS_API int TESS_CALL TessBaseAPIInit4(TessBaseAPI* handle, const char* datapath, const char* language, TessOcrEngineMode mode,
|
2014-02-03 07:50:47 +08:00
|
|
|
char** configs, int configs_size,
|
|
|
|
char** vars_vec, char** vars_values, size_t vars_vec_size,
|
|
|
|
BOOL set_only_non_debug_params);
|
2014-02-01 18:36:40 +08:00
|
|
|
|
2012-09-24 13:14:11 +08:00
|
|
|
TESS_API const char*
|
|
|
|
TESS_CALL TessBaseAPIGetInitLanguagesAsString(const TessBaseAPI* handle);
|
|
|
|
TESS_API char**
|
|
|
|
TESS_CALL TessBaseAPIGetLoadedLanguagesAsVector(const TessBaseAPI* handle);
|
2012-09-24 13:20:23 +08:00
|
|
|
TESS_API char**
|
|
|
|
TESS_CALL TessBaseAPIGetAvailableLanguagesAsVector(const TessBaseAPI* handle);
|
2012-09-24 13:14:11 +08:00
|
|
|
|
|
|
|
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);
|
2014-05-26 05:03:11 +08:00
|
|
|
TESS_API void TESS_CALL TessBaseAPISetImage2(TessBaseAPI* handle, struct Pix* pix);
|
2012-09-24 13:14:11 +08:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
#ifdef TESS_CAPI_INCLUDE_BASEAPI
|
|
|
|
TESS_API void TESS_CALL TessBaseAPISetThresholder(TessBaseAPI* handle, TessImageThresholder* thresholder);
|
|
|
|
#endif
|
|
|
|
|
2013-04-30 01:57:21 +08:00
|
|
|
TESS_API struct Pix*
|
|
|
|
TESS_CALL TessBaseAPIGetThresholdedImage( TessBaseAPI* handle);
|
|
|
|
TESS_API struct Boxa*
|
|
|
|
TESS_CALL TessBaseAPIGetRegions( TessBaseAPI* handle, struct Pixa** pixa);
|
|
|
|
TESS_API struct Boxa*
|
|
|
|
TESS_CALL TessBaseAPIGetTextlines( TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
|
2014-02-03 21:24:55 +08:00
|
|
|
TESS_API struct Boxa*
|
|
|
|
TESS_CALL TessBaseAPIGetTextlines1( TessBaseAPI* handle, const BOOL raw_image, const int raw_padding,
|
|
|
|
struct Pixa** pixa, int** blockids, int** paraids);
|
2013-04-30 01:57:21 +08:00
|
|
|
TESS_API struct Boxa*
|
|
|
|
TESS_CALL TessBaseAPIGetStrips( TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
|
|
|
|
TESS_API struct Boxa*
|
|
|
|
TESS_CALL TessBaseAPIGetWords( TessBaseAPI* handle, struct Pixa** pixa);
|
|
|
|
TESS_API struct Boxa*
|
|
|
|
TESS_CALL TessBaseAPIGetConnectedComponents(TessBaseAPI* handle, struct Pixa** cc);
|
|
|
|
TESS_API struct Boxa*
|
2014-02-03 21:24:55 +08:00
|
|
|
TESS_CALL TessBaseAPIGetComponentImages( TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
|
|
|
|
struct Pixa** pixa, int** blockids);
|
|
|
|
TESS_API struct Boxa*
|
|
|
|
TESS_CALL TessBaseAPIGetComponentImages1( TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
|
|
|
|
const BOOL raw_image, const int raw_padding,
|
|
|
|
struct Pixa** pixa, int** blockids, int** paraids);
|
2012-09-24 13:14:11 +08:00
|
|
|
|
|
|
|
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);
|
2014-05-26 05:03:11 +08:00
|
|
|
TESS_API BOOL TESS_CALL TessBaseAPIProcessPages(TessBaseAPI* handle, const char* filename, const char* retry_config,
|
2014-02-03 07:50:47 +08:00
|
|
|
int timeout_millisec, TessResultRenderer* renderer);
|
2014-05-26 05:03:11 +08:00
|
|
|
TESS_API BOOL TESS_CALL TessBaseAPIProcessPage(TessBaseAPI* handle, struct Pix* pix, int page_index, const char* filename,
|
|
|
|
const char* retry_config, int timeout_millisec, TessResultRenderer* renderer);
|
2012-09-24 13:14:11 +08:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2014-02-03 07:50:47 +08:00
|
|
|
TESS_API int TESS_CALL TessBaseAPIIsValidWord(TessBaseAPI* handle, const char* word);
|
2012-09-24 13:14:11 +08:00
|
|
|
TESS_API BOOL TESS_CALL TessBaseAPIGetTextDirection(TessBaseAPI* handle, int* out_offset, float* out_slope);
|
|
|
|
|
|
|
|
#ifdef TESS_CAPI_INCLUDE_BASEAPI
|
|
|
|
TESS_API void TESS_CALL TessBaseAPISetDictFunc(TessBaseAPI* handle, TessDictFunc f);
|
2014-02-03 21:24:55 +08:00
|
|
|
TESS_API void TESS_CALL TessBaseAPIClearPersistentCache(TessBaseAPI* handle);
|
2012-09-24 13:14:11 +08:00
|
|
|
TESS_API void TESS_CALL TessBaseAPISetProbabilityInContextFunc(TessBaseAPI* handle, TessProbabilityInContextFunc f);
|
2014-02-05 04:01:55 +08:00
|
|
|
|
2012-09-24 13:14:11 +08:00
|
|
|
TESS_API void TESS_CALL TessBaseAPISetFillLatticeFunc(TessBaseAPI* handle, TessFillLatticeFunc f);
|
2016-12-08 05:21:05 +08:00
|
|
|
|
|
|
|
// Call TessDeleteText(*best_script_name) to free memory allocated by this function
|
2016-12-09 07:08:48 +08:00
|
|
|
TESS_API BOOL TESS_CALL TessBaseAPIDetectOrientationScript(TessBaseAPI* handle,
|
|
|
|
int* orient_deg, float* orient_conf, const char **script_name, float* script_conf);
|
2016-12-08 05:21:05 +08:00
|
|
|
|
2013-09-23 23:26:50 +08:00
|
|
|
TESS_API void TESS_CALL TessBaseAPIGetFeaturesForBlob(TessBaseAPI* handle, TBLOB* blob, INT_FEATURE_STRUCT* int_features,
|
2012-09-24 13:14:11 +08:00
|
|
|
int* num_features, int* FeatureOutlineIndex);
|
|
|
|
|
|
|
|
TESS_API ROW* TESS_CALL TessFindRowForBox(BLOCK_LIST* blocks, int left, int top, int right, int bottom);
|
2013-09-23 23:26:50 +08:00
|
|
|
TESS_API void TESS_CALL TessBaseAPIRunAdaptiveClassifier(TessBaseAPI* handle, TBLOB* blob, int num_max_matches,
|
2012-09-24 13:14:11 +08:00
|
|
|
int* unichar_ids, float* ratings, int* num_matches_returned);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
TESS_API const char*
|
|
|
|
TESS_CALL TessBaseAPIGetUnichar(TessBaseAPI* handle, int unichar_id);
|
|
|
|
|
|
|
|
#ifdef TESS_CAPI_INCLUDE_BASEAPI
|
|
|
|
TESS_API const TessDawg*
|
|
|
|
TESS_CALL TessBaseAPIGetDawg(const TessBaseAPI* handle, int i);
|
|
|
|
TESS_API int TESS_CALL TessBaseAPINumDawgs(const TessBaseAPI* handle);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TESS_CAPI_INCLUDE_BASEAPI
|
|
|
|
TESS_API ROW* TESS_CALL TessMakeTessOCRRow(float baseline, float xheight, float descender, float ascender);
|
|
|
|
TESS_API TBLOB*
|
2014-02-03 07:50:47 +08:00
|
|
|
TESS_CALL TessMakeTBLOB(Pix* pix);
|
|
|
|
TESS_API void TESS_CALL TessNormalizeTBLOB(TBLOB* tblob, ROW* row, BOOL numeric_mode);
|
2012-09-24 13:14:11 +08:00
|
|
|
|
|
|
|
TESS_API TessOcrEngineMode
|
|
|
|
TESS_CALL TessBaseAPIOem(const TessBaseAPI* handle);
|
2014-02-03 07:50:47 +08:00
|
|
|
TESS_API void TESS_CALL TessBaseAPIInitTruthCallback(TessBaseAPI* handle, TessTruthCallback* cb);
|
2016-12-15 03:37:51 +08:00
|
|
|
#endif
|
2012-09-24 13:14:11 +08:00
|
|
|
|
|
|
|
TESS_API void TESS_CALL TessBaseAPISetMinOrientationMargin(TessBaseAPI* handle, double margin);
|
|
|
|
#ifdef TESS_CAPI_INCLUDE_BASEAPI
|
2014-12-29 00:55:56 +08:00
|
|
|
TESS_API void TESS_CALL TessBaseGetBlockTextOrientations(TessBaseAPI* handle, int** block_orientation, BOOL** vertical_writing);
|
2012-09-24 13:14:11 +08:00
|
|
|
|
|
|
|
TESS_API BLOCK_LIST*
|
|
|
|
TESS_CALL TessBaseAPIFindLinesCreateBlockList(TessBaseAPI* handle);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Page iterator */
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2013-04-30 01:57:21 +08:00
|
|
|
TESS_API struct Pix*
|
|
|
|
TESS_CALL TessPageIteratorGetBinaryImage(const TessPageIterator* handle, TessPageIteratorLevel level);
|
|
|
|
TESS_API struct Pix*
|
|
|
|
TESS_CALL TessPageIteratorGetImage(const TessPageIterator* handle, TessPageIteratorLevel level, int padding,
|
2014-05-26 05:03:11 +08:00
|
|
|
struct Pix* original_image, int* left, int* top);
|
2012-09-24 13:14:11 +08:00
|
|
|
|
|
|
|
TESS_API BOOL TESS_CALL TessPageIteratorBaseline(const TessPageIterator* handle, TessPageIteratorLevel level,
|
|
|
|
int* x1, int* y1, int* x2, int* y2);
|
|
|
|
|
2014-02-03 07:50:47 +08:00
|
|
|
TESS_API void TESS_CALL TessPageIteratorOrientation(TessPageIterator* handle, TessOrientation* orientation,
|
|
|
|
TessWritingDirection* writing_direction, TessTextlineOrder* textline_order,
|
|
|
|
float* deskew_angle);
|
2012-09-24 13:14:11 +08:00
|
|
|
|
2014-12-07 21:07:14 +08:00
|
|
|
TESS_API void TESS_CALL TessPageIteratorParagraphInfo(TessPageIterator* handle, TessParagraphJustification* justification,
|
2014-12-29 00:55:56 +08:00
|
|
|
BOOL *is_list_item, BOOL *is_crown, int *first_line_indent);
|
2014-12-07 21:07:14 +08:00
|
|
|
|
2012-09-24 13:14:11 +08:00
|
|
|
/* Result iterator */
|
|
|
|
|
|
|
|
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);
|
2014-10-15 04:46:11 +08:00
|
|
|
TESS_API TessChoiceIterator*
|
2014-05-03 17:29:20 +08:00
|
|
|
TESS_CALL TessResultIteratorGetChoiceIterator(const TessResultIterator* handle);
|
2012-09-24 13:14:11 +08:00
|
|
|
|
2014-05-03 17:29:20 +08:00
|
|
|
TESS_API BOOL TESS_CALL TessResultIteratorNext(TessResultIterator* handle, TessPageIteratorLevel level);
|
2012-09-24 13:14:11 +08:00
|
|
|
TESS_API char* TESS_CALL TessResultIteratorGetUTF8Text(const TessResultIterator* handle, TessPageIteratorLevel level);
|
|
|
|
TESS_API float TESS_CALL TessResultIteratorConfidence(const TessResultIterator* handle, TessPageIteratorLevel level);
|
2014-05-17 02:35:54 +08:00
|
|
|
TESS_API const char*
|
|
|
|
TESS_CALL TessResultIteratorWordRecognitionLanguage(const TessResultIterator* handle);
|
2012-09-24 13:14:11 +08:00
|
|
|
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);
|
|
|
|
|
2014-05-04 04:21:37 +08:00
|
|
|
TESS_API void TESS_CALL TessChoiceIteratorDelete(TessChoiceIterator* handle);
|
2014-05-03 17:29:20 +08:00
|
|
|
TESS_API BOOL TESS_CALL TessChoiceIteratorNext(TessChoiceIterator* handle);
|
|
|
|
TESS_API const char* TESS_CALL TessChoiceIteratorGetUTF8Text(const TessChoiceIterator* handle);
|
|
|
|
TESS_API float TESS_CALL TessChoiceIteratorConfidence(const TessChoiceIterator* handle);
|
|
|
|
|
2012-09-24 13:14:11 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-03-19 02:17:09 +08:00
|
|
|
#endif // API_CAPI_H_
|