📄 ocrclass.h
字号:
OCR_ERR_INTERNAL3, /*internal error type 1 */ OCR_ERR_INTERNAL4, /*internal error type 1 */ OCR_ERR_INTERNAL5, /*internal error type 1 */ OCR_ERR_INTERNAL6, /*internal error type 1 */ OCR_ERR_INTERNAL7, /*internal error type 1 */ OCR_ERR_INTERNAL8, /*internal error type 1 */ OCR_ERR_TIMEOUT /*timed out in comms */}; /*for calls to ocr_error *//********************************************************************** * EFONT_DESC * Description of one font. * The information required is basically that used by RTF. * The name may be either a valid font on the system or the empty string. **********************************************************************/typedef struct /*font description */{ UINT16 language; /*default language */ UINT8 font_family; /*serif/not, fixed/not */ UINT8 char_set; /*character set standard */ UINT8 pitch; /*fixed or prop */ INT8 name[MAX_FONT_NAME + 1]; /*plain ascii name */} EFONT_DESC; /*font description *//********************************************************************** * EOCR_DESC * Description of the OCR engine provided at startup. * The name and version may be reported to the user at some point. * The fonts array should indicate the fonts that the OCR system * can recognize. **********************************************************************/typedef struct /*startup info */{ INT32 protocol; /*interface version */ UINT32 font_count; /*number of fonts */ UINT16 language; /*default language */ UINT16 name[MAX_OCR_NAME + 1]; /*name of engine */ /*version of engine */ UINT16 version[MAX_OCR_VERSION + 1]; EFONT_DESC fonts[1]; /*array of fonts */} EOCR_DESC; /*startup info *//********************************************************************** * ESTRIP_DESC * Description of the image strip as it is passed to the engine. * The image is always 1 bit, with 1=black. * The width is always a multiple of 32, so padding is always OK. * The height of the full image is always a multiple of 32. * The top y coordinate is 0, and increases down. * The top leftmost pixel is in the most significant bit of the first byte. **********************************************************************/typedef struct /*bitmap strip */{ INT16 x_size; /*width in pixels */ INT16 y_size; /*of full image */ INT16 strip_size; /*of this strip */ INT16 resolution; /*pixels per inch */ UINT8 data[8]; /*image data */} ESTRIP_DESC; /*bitmap strip *//********************************************************************** * EANYCODE_CHAR * Description of a single character. The character code is defined by * the character set of the current font. * Output text is sent as an array of these structures. * Spaces and line endings in the output are represented in the * structures of the surrounding characters. They are not directly * represented as characters. * The first character in a word has a positive value of blanks. * Missing information should be set to the defaults in the comments. * If word bounds are known, but not character bounds, then the top and * bottom of each character should be those of the word. The left of the * first and right of the last char in each word should be set. All other * lefts and rights should be set to -1. * If set, the values of right and bottom are left+width and top+height. * Most of the members come directly from the parameters to ocr_append_char. * The formatting member uses the enhancement parameter and combines the * line direction stuff into the top 3 bits. * The coding is 0=RL char, 1=LR char, 2=DR NL, 3=UL NL, 4=DR Para, * 5=UL Para, 6=TB char, 7=BT char. API users do not need to know what * the coding is, only that it is backwards compatible with the previous * version. **********************************************************************/typedef struct /*single character */{ UINT16 char_code; /*character itself */ INT16 left; /*of char (-1) */ INT16 right; /*of char (-1) */ INT16 top; /*of char (-1) */ INT16 bottom; /*of char (-1) */ INT16 font_index; /*what font (0) */ UINT8 confidence; /*0=perfect, 100=reject (0/100) */ UINT8 point_size; /*of char, 72=i inch, (10) */ INT8 blanks; /*no of spaces before this char (1) */ UINT8 formatting; /*char formatting (0) */} EANYCODE_CHAR; /*single character *//********************************************************************** * ETEXT_DESC * Description of the output of the OCR engine. * This structure is used as both a progress monitor and the final * output header, since it needs to be a valid progress monitor while * the OCR engine is storing its output to shared memory. * During progress, all the buffer info is -1. * Progress starts at 0 and increases to 100 during OCR. No other constraint. * Every progress callback, the OCR engine must set ocr_alive to 1. * The HP side will set ocr_alive to 0. Repeated failure to reset * to 1 indicates that the OCR engine is dead. * If the cancel function is not null then it is called with the number of * user words found. If it returns true then operation is cancelled. **********************************************************************/typedef bool (*CANCEL_FUNC)(void* cancel_this, int words);typedef struct /*output header */{ INT16 count; /*chars in this buffer(0) */ INT16 progress; /*percent complete increasing (0-100) */ INT8 more_to_come; /*true if not last */ INT8 ocr_alive; /*ocr sets to 1, HP 0 */ INT8 err_code; /*for errcode use */ CANCEL_FUNC cancel; /*returns true to cancel */ void* cancel_this; /*this or other data for cancel*/ clock_t end_time; /*time to stop if not 0*/ EANYCODE_CHAR text[1]; /*character data */} ETEXT_DESC; /*output header */#ifdef __MSW32__/********************************************************************** * ESHM_INFO * This data structure is used internally to the API to hold the handles * to the operating system tools used for interprocess communications. * API users do not access this structure directly. **********************************************************************/typedef struct /*shared mem info */{ HANDLE shm_hand; /*handle to shm */ HANDLE mutex; /*alive check */ HANDLE ocr_sem; /*ocr semaphore */ HANDLE hp_sem; /*hp semaphore */ void *shm_mem; /*shared memory */ INT32 shm_size; /*size of shm */} ESHM_INFO; /*shared mem info */#elif defined (__MAC__)typedef struct /*shared mem info */{ Boolean mutex; /*alive check */ Boolean ocr_sem; /*ocr semaphore */ Boolean hp_sem; /*hp semaphore */ void *shm_mem; /*shared memory */ INT32 shm_size; /*size of shm */ INT16 language; // Process management information follows: ProcessSerialNumber IPEProcess; ProcessSerialNumber OCRProcess;} ESHM_INFO;#elif defined (__UNIX__)typedef struct /*shared mem info */{ void *shm_mem; /*shared memory */ INT32 shm_size; /*size of shm */} ESHM_INFO;#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -