RepData
typedef struct RepData_tag {
ReInit init;
ReParm parm;
ReImage image;
long busy;
INT_PTR hWND_rep_finished;
INT_PTR hWND_line_message;
long filler1;
KADMOS_ERROR (KADMOS_API *rec_hook)(RecData *);
KADMOS_ERROR (KADMOS_API *rel_hook)(RelData *);
short rep_deskew;
short rep_result_len;
RepResult *rep_result;
} RepData;
Elements:
init
- Data for classifier initialisation. It must be set before
rep_init()
.
parm
- REP can be performed with many parameters. These parameters are included in the structure
ReParm
.
image
- In this structure
ReImage
the image processing and/or recognition will be expected or provided.
busy
- This value indicates whether recognition is in process (1) or completed (0). This is particularly important
for parallel processing.
hWND_rep_finished
- This parameter is relevant for Windows only. If provided, the module
rep_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, rep_do() will perform the following call:
SendMessage((HWND) rep->hWND_rep_finished, WM_USER,
(WPARAM)(REP_MESSAGE | REX_IMGREADY), (LPARAM) rep);
This gives the possibility to retrieve the result of the preprocessing (rep->image
) before recognition.
The pointer image will be set to the internal preprocessed image for this call. As soon as the text lines are separated
and recognized, rep_do()
will perform the following call:
SendMessage((HWND) rep->hWND_rep_finished,WM_USER,
(WPARAM)(REP_MESSAGE | REX_FINISHED), (LPARAM) rep);
In case of an error wParm
contains also the bit REX_ERROR
.
hWND_line_message
- This parameter is relevant for Windows only. If provided, the module rep_do() will send messages to
that window, which is described as handle by this value. As soon as the text lines are separated,
rep_do()
will perform the following call:
SendMessage((HWND) rep->hWND_line_message, WM_USER,
(WPARAM) REP_LINE_CNT,(LPARAM) zeilenanzahl);
After recognition of each single text line rep_do()
will send the following message:
SendMessage((HWND) rep->hWND_line_message, WM_USER,
(WPARAM) REP_RESULT,(LPARAM) &rep_result);
From the address given in lParam
all recognition results of this text line can be retrieved. The address is
a pointer to a structure RepResult
. REP_LINE_CNT
and REP_RESULT
are defined as follows:
#define REP_LINE_CNT 1
#define REP_RESULT 2
filler1
- 8 byte alignment.
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()
stopp the recognition and returns 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.
rel_hook
- This parameter allows an application to provide a private hook function. Is it set to suck a function, this
function will be called analog to
rec_hook
with every call of rel_do()
with a structure
RelData
. This function can be used to stop the recognition.
rep_deskew
- Corrected skew of the image.
rep_result_len, rep_result
- After calling of
rep_do()
, rep_result_len
contains the number of separated
text lines of a given image. rep_result
is a pointer to an area of structures RepResult
, one
item for every line, containing the recognition results. If grid elements are detected, then rep_result[0]
refers to a related data structure, and rep_result_len
equals the number of recognized lines +1.
Reference: