OCR plugins API

OCR plugins are used by search engine to extract text from graphical formats.

OCR engine path is defined in dictionary.xml file in <ocr_engine>...</ocr_engine> node.

Sample OCR engine plugin is shipped with SDK. It is powered by GNU OCRad engine.

API

1. Plugin instance construction and initialization

 void* Constructor(void)

This procedure is called once per search engine session. Its main purpose is to load all necessary DLL, read configuration files and so on.

It returns the pointer to plugin object which is used in all subsequent calls as This argument.

2.  Plugin instance destruction

void Destructor( void *This )

It frees resources allocated by plugin instance during Constructor call.

This procedure is called on search engine termination.

3. Recognize text on image file

int RecognizeFile( void *This, IGrammarEngine *IGrammarEnginePtr, const wchar_t *Filename, wchar_r **Block )

This function extracts text in the image file Filename and returns this text in allocated memory block Block.

IGrammarEnginePtr is an interface to grammar engine services (morphology analyzer etc.)

Return value: 1 - success.

4. Recognize text on memory bitmap

int RecognizeDIB( void *This, IGrammarEngine *IGrammarEnginePtr, HBITMAP hBmp, wchar_r **Block )

This function extract text in the bitmap image hBmp and returns this text in allocated memory block Block.

IGrammarEnginePtr is an interface to grammar engine services (morphology analyzer etc.)

Return value: 1 - success.

5. Free memory block

void Free( void *This, void *Ptr )

This function frees the memory block Ptr. Usually it is invoked after RecognizeFile and RecognizeDIB functions which allocate memory block to write recognized text.


© Mental Computing 2009  rss  email  icq free counters Πειςθνγ@Mail.ru