ReInit

typedef struct ReInit_tag {
  char    version[8];        
  int     rel_grid_maxlen;
  int     rel_graph_maxlen;
  int     rel_result_maxlen;
  int     options;
  void    *rep_memory;
  long    rep_memory_size;
  
  void * (*zip_open) (const char *file_title, const char *mode);
  void * (*zip_wopen) (const wchar_t *file_title, const char *mode);
  int    (*zip_compressed) (const char *file_title);
  int    (*zip_wcompressed) (const wchar_t *file_title);
  int    (*zip_read) (void *file, void *buf, unsigned long len);
  int    (*zip_close)(void *file);

  INT_PTR interna1[4];
  INT_PTR interna2[4];
} ReInit;
      

Elemente

version[8]
Check of the correct KADMOS version.
rel_grid_maxlen
Maximum numbers of grid elements per image in rel_grid.
rel_graph_maxlen
Maximum number of graph elements per image in rel_graph.
rel_result_maxlen
Maximum number of result elements per image in in rel_result.
options
Now it is possible to read only parts of big classifiers (REC files). This has the same effect as the restriction of classifiers by Chopper.exe and can yield huge reductions of computing time.
*rep_memory
Takes the rep_result(s).
rep_memory_size
Size of rep_memory in bytes for rep_do().
*zip_open
Open a Zip-File.
*zip_wopen
open a Zip-File. The file name is expected in Unicode.
*zip_compressed
if zip_compressed is not specified, the extension ".gz" signals compression.
*zip_wcompressed
if zip_(w)compressed is not specified, the extension ".gz" signals compression.
*zip_read
read a Zip-File.
*zip_close
Close a Zip-File.
interna1[4]
Do not change.
interna2[4]
Do not change.

Comment:

During recognition of a text image, a lot of information is retrieved, which may be important for further processing. The amount of this information not only depends on the image size, but also on the number of text lines as well as on the number of single characters in the image. To deliver this information the module needs memory, and after processing this memory must be given back to the system. This means memory allocation and management is the responsibility of the respective application. The value of rep_memory must be set with a pointer to this memory, the value of rep_memory_size must be set to the size of this memory in bytes. Before the initialization the parameter rel_result_maxlen must be set to the maximum number of expected characters per line (see also rel_graph_len and rel_result_len in the structure RelData). Before the initialization rel_grid_maxlen has to be set to the maximum number of grid elements per image (if required) for which memory has been provided to hold recognition results. How much memory is required dependens upon the structures containing the recognition results. They include RelGrid, RelGraph, and RelResult for the results of one text line and RepResult for the results of the REP module. For each text line, a structure RepResult is returned, and for every single character of every line, two structures RelGraph and RelResult, for possible alternative segmentation points appropriate more. If information about line elements is wanted, than memory for the related structures RelGrid has to be provided for every text line.
Zeichenposition
Pointer rep_result, RepResult[0] optionally includes grid information RelGrid.
Ponter rep_result, ein RepResult for each text line.
Pointer rel_grid, ein RelGrid per line element.
Pointer rel_graph, ein RelGraph for each segmentation point.
Pointer rel_result, ein RelResult per character of a text line.

If MAX_LINE contains the maximum value of expected textlines, MAX_GRID the maximum value of grid elements, and MAX_CHAR the maximum value of expected characters per line, then the value of rep_memory_size can be determined by the following formula:

rep.init.rep_memory_size = MAX_LINE*sizeof(RepResult) +  
                           MAX_GRID*sizeof(RelGrid) + 
                           MAX_LINE*MAX_CHAR*sizeof(RelGraph) + 
                           MAX_LINE*MAX_CHAR*sizeof(RelResult);
⚠️ If the provided memory area rep_memory is too small, the main effect will be the loss of some recognition results.
Memory not necessarily has to be allocated, and values of rep_memory and rep_memory_size may be set to NULL resp. 0. Then, after calling rep_do() there will be no results available under rep_result. In this case the recognition results have to be retrieved from a function rel_hook() using the messages WM_USER REP_LINE_CNT and WM_USER REP_RESULT.

options makes it possible to read only parts of big classifiers (REC files). This has the same effect as the restriction of classifiers by Chopper.exe and can yield huge reductions of computing time. How to apply: Before the call of re?_init() you have to set ReInit.options to OPTIONS_RESTRICT_LABELS and you have to set the parameters ReParm.labels_size, ReParm.labels, and ReParm.rejects, the latter to the required labels and rejects. Now the subsequent call of re?_init() only reads the specified part of the classifier into memory, which is needed to recognize these labels and rejects.

Reference: