Skip to content

ollydev/libTesseract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Downloads are available here https://github.com/ollydev/libtesseract/releases


This is a shared library (dll, so, dylib) which exports basic C Tesseract-OCR functions for basic text recognition. Tesseract and it's dependencies have been statically linked so only a single library is required.

The following methods are exported:

tesseract::TessBaseAPI* Tesseract_Create();
void Tesseract_Delete(tesseract::TessBaseAPI* &tesseract_ptr);
int Tesseract_Init(tesseract::TessBaseAPI* tesseract_ptr, const char* datapath, const char* language);
void Tesseract_End(tesseract::TessBaseAPI* &tesseract_ptr);
void Tesseract_SetImage(tesseract::TessBaseAPI* tesseract_ptr, const unsigned char* imagedata, int width, int height, int bytes_per_pixel, int bytes_per_line);
const char* Tesseract_GetUTF8Text(tesseract::TessBaseAPI* tesseract_ptr, uint32_t* len);
void Tesseract_FreeUTF8Text(char* &utf8_text_ptr);
bool Tesseract_SetVariable(tesseract::TessBaseAPI* tesseract_ptr, const char* name, const char* value);
void Tesseract_Clear(tesseract::TessBaseAPI* tesseract_ptr);
int Tesseract_GetLineCount(tesseract::TessBaseAPI* tesseract_ptr); 
int Tesseract_GetWordCount(tesseract::TessBaseAPI* tesseract_ptr); 
int Tesseract_GetCharacterCount(tesseract::TessBaseAPI* tesseract_ptr); 
void Tesseract_GetLineMatch(tesseract::TessBaseAPI* tesseract_ptr, int index, char* &text, int* len, float* confidence, int* x1, int* y1, int* x2, int* y2); 
void Tesseract_GetWordMatch(tesseract::TessBaseAPI* tesseract_ptr, int index, char* &text, int* len, float* confidence, int* x1, int* y1, int* x2, int* y2); 
void Tesseract_GetCharacterMatch(tesseract::TessBaseAPI* tesseract_ptr, int index, char* &text, int* len, float* confidence, int* x1, int* y1, int* x2, int* y2);

Example Pascal header:

function Tesseract_Init(ptr: Pointer; datapath, language: PChar): Int32; external 'libtesseract32.dll'

See the Github Action to see how this is built. Thanks to SoftwareNetwork for making this a lot easier than it used to be.