ocrclass.h
来自「一个google的OCR源码」· C头文件 代码 · 共 346 行 · 第 1/2 页
H
346 行
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 */{// It should be noted that the format for char_code for version 2.0 and beyond is UTF8// which means that ASCII characters will come out as one structure but other characters// will be returned in two or more instances of this structure with a single byte of the// UTF8 code in each, but each will have the same bounding box.// Programs which want to handle languagues with different characters sets will need to// handle extended characters appropriately, but *all* code needs to be prepared to// receive UTF8 coded characters for characters such as bullet and fancy quotes. 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 ETEXT_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 + =
减小字号Ctrl + -
显示快捷键?