RelData

typedef struct RelData_tag {
  ReInit    init;             
  ReParm    parm;             
  ReImage   image;           
  long      image_top;         
  long      image_bottom;
  long      busy;              
  INT_PTR hWND_rel_finished; 
  KADMOS_ERROR (KADMOS_API *rec_hook)(RecData *);  
  void      *filler1;           
  long      left, top;         
  long      width, height;
  short     rel_deskew;        
  short     rel_char_space;    
  short     rel_blank_width;   
  short     rel_blank_min;     
  short     rel_grid_len;      
  short     rel_graph_len;
  short     rel_result_len;    
  short     filler2;           
  RelGrid   *rel_grid;       
  RelGraph  *rel_graph;     
  RelResult *rel_result;
  void      *filler3;           
} RelData;        
      

Elements:

init
Data for classifier initialisation. It must be set before rel_init().
parm
REL can be performed with many parameters. These parameters are included in the strcture ReParm. Such a structure is now part of the data structure RelData.
image
In this structure ReImage the image for processing and/or recognition will be expected or provided.
image_top, image_bottom
As image_top and image_bottom the upper and lower border of the character(s) can be specified, based on the scale given by base_line. For base_line=64 typical values for single characters are:
Zeichenposition
- A image_top=0, image_bottom=64,
- Ü image_top=-16, image_bottom=64
- a image_top=14, image_bottom=64,
- g image_top=14, image_bottom=82
If no values are specified here, the REC module keeps all alternative results. The module REL tries to find the top and bottom line by evaluating the position of accurate recognition results. This information is used to exclude alternatives that don't fit into the detected line structure. For finer control of this evaluation and the related exclusion of alternatives, the macros POS_NOliNECONTEXT, POS_SOFTliNECONTEXT, and POS_HARdlINECONTEXT in the parameter pos can be used.
busy
This value indicates whether recognition is in process (1) or completed (0). This is particularly important for parallel processing.
hWND_rel_finished
This parameter is relevant for Windows only. If provided, the module rel_do() will send messages to that window, which is described as handle by this value. As soon as the preprocessing of the image has been finished, rel_do() will perform the following call:
SendMessage((HWND) rel->hWND_rel_finished, WM_USER,
(WPARAM)(REL_MESSAGE | REX_IMGREADY), (LPARAM) rel);
This gives the possibility to retrieve the result of the preprocessing (rel->image) before recognition. The pointer image will be set to the internal preprocessed image for this call. As soon as the recognition of the text line is finished, rel_do() will perform the following call:
SendMessage((HWND) rel->hWND_rel_finished, WM_USER,
(WPARAM) (REL_MESSAGE | REX_FINISHED), (LPARAM) rel);
In case of an error wParm also contains the bit REX_ERROR.
rec_hook
This parameter allows an application to provide a particular function. The modules REL and REP always call the module REC - after segmenting the given image in lines and single characters. For each character, the module rec_do() is called with a related, internal structure RecData. If rec_hook is specified, it is called directly after every rec_do() call, with the related structure RecData. This provides many possibilities for tracking or controlling the isolated character recognition, for collecting samples and even to stop recognition. The latter possibility is given by the return value of the hook function. If the hook function return a value different from RE_SUCCESS, rel_do() and rep_do() stop the recognition and return immediately. If a hook function needs its own specific parameters, the pointer hookparm in the structure ReParm can be used. If for example hookparm is assigned an address (for example to private data) before calling rel_do(), this address will be copied by rel_do() before every call to rec_do() into the related structure RecData into the item hookparm. This address can then be retrieved by the hook function.
filler1
8 byte alignment.
left, top
These items hold the position of the image.
width, height
Width and height of the line in the image.
rel_deskew
Corrected skew of the line image.
rel_char_space
rel_char_space describes the mean distance of two successive cha racters of the text line, i.e. the distance from the beginning of one character to the beginning of the next. These values are necessary for correct reproduction of the recognized text, especially with equidistant fonts.
rel_blank_width
rel_blank_width is set to zero with equidistant fonts. In the case that the REL module detects proportional spacing, it supplies the computed width of the blank character.
rel_blank_min
rel_blank_min also is set to zero with equidistant fonts. For proportional spacing the limit is supplied from that gaps between characters which are counted as blanks.
rel_grid_len
These items are located in the result part of the structures RelData and RepResult. If box or line grid information shall be provided, then before calling rel_init() the expected maximum value must be set at rel_grid_maxlen. Before calling rel_do(), rel_grid has to refer to adequate memory for all RelGrid structures needed. The actual number of recognized structure elements is provided in rel_grid_len after calls to rel_do().
rel_graph_len, rel_result_len
These items are located in the result part of the structure RelData and RepResult and provide the number of recognized single characters. The items rel_graph_maxlen and rel_result_maxlen have to be set with maximum values before calling rel_init(), dependent on the size of the two arrays rel_graph and rel_result. This is only to protect your application and to prevent rel_do() from writing beyond the allocated memory. After every call of rel_do() or rep_do(), rel_graph_len and rel_result_len contain the number of actual recognized array elements in rel_graph and rel_result.
filler2
8 byte alignment.
*rel_grid
These items are located in the result part of the structures RelData and RepResult. If box or line grid information shall be provided, then before calling rel_init() or rep_init() the expected maximum value must be set at rel_grid_maxlen. Before calling rel_do(), rel_grid has to refer to adequate memory for all RelGrid structures needed. The actual number of recognized structure elements is provided in rel_grid_len after calls to rel_do().
*rel_graph, *rel_result
These two items refer to the results of segmentation and classification. The results are contained in arrays of type RelGraph and RelResult. Before calling rel_do(), rel_graph and rel_result have to be set with pointers to memory where rel_do() can fill in the recognition results (see rel_graph_len, rel_graph_maxlen, rel_result_len and rel_result_maxlen).
filler3
8 byte alignment.

Reference: