RecData
typedef struct RecData_tag {
ReInit init;
ReParm parm;
ReImage image;
long image_top;
long image_bottom;
long busy;
INT_PTR hWND_rec_finished;
long left, top;
long width, height;
long result_flags;
void *result_image;
long result_width;
long result_height;
long projection[2];
short italic, bold;
short strokelen, black;
#if defined(__STDC__)
char rec_char[REC_ALT][REC_CHAR_SIZE];
#else
union {
char rec_char[REC_ALT][REC_CHAR_SIZE];
short rec_char2[REC_ALT][REC_CHAR_SIZE/2];
};
#endif
unsigned char rec_value[REC_ALT];
long rec_top[REC_ALT];
long rec_bottom[REC_ALT];
} RecData;
Elements:
init
- Data for classifier initialisation. It must be set before
rec_init().
parm
- REC can be performed with many parameters. These parameters are included in the structure
ReParm.
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:

- 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_rec_finished
- This parameter is relevant for Windows only. If provided, the module
rec_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, rec_do() will perform the following call:
SendMessage((HWND) rec->hWND_rec_finished, WM_USER,
(WPARAM)(REC_MESSAGE | REX_IMGREADY), (LPARAM) rec);
This gives the possibility to retrieve the result of the preprocessing (rec->image) before recognition.
The pointer image will be set to the internal preprocessed image for this call. As soon as the recognition of a
character is finished, rec_do() will perform the following call:
SendMessage((HWND) rec->hWND_rec_finished, WM_USER,
(WPARAM)(REC_MESSAGE | REX_FINISHED), (LPARAM) rec);
In case of an error wParm contains also the bit REX_ERROR.
left, top
- Position of the character after noise reduction.
width, height
- Height and width of the character after noise reduction.
result_flags
- The data element result_flags is set with
RESULT_FLAG_RESPELL whenever the related result
is approved by a dictionary lookup (RESPELL).
RESULT_FLAG_RESPELL_CONFIRMED wird gesetzt wenn durch RESPELL bestätigt wurde.
RESULT_FLAG_RESPELL_GENERATED wird gesetzt wenn durch RESPELL generiert wurde.
RESULT_FLAG_RESPELL zur Abfrage ob RESULT_FLAG_RESPELL_CONFIRMED oder
RESULT_FLAG_RESPELL_GENERATED gesetzt wurden.
result_image
- If
TYPO_KEEPIMG is set at the parameter parm.typograph, the segmented characters
are provided as images. The required memory is allocated and controlled from the REL module but can be freed
directly with the function rel_freeimages(). Images are stored line by line, starting with the top line first.
The lines are stored pixel by pixel, the most left pixel is stored first, and each pixel is represented as one byte.
result_height contains the number of lines, result_width the number of columns of the image.
Prior to result_image the related surrounding rectangle is found in the data structures RecData and
RelResult. This describes the position of the images within the supplied original image. Please consider that
the dimensions of the surrounding rectangle and the image dimensions are not always the same. Large images are compressed
by the REL module and extraction is made from this compressed data.
result_width, result_height
- Height and width of result_image (can be compressed).
projection[2]
- Projection according to the mean slant of the characters of the line from the start and the end of the character onto the baseline.
italic, bold
Slant of characters (italic).
These items are set the detected slant and stroke width of the given character. It is not easy to define the slant of a
character. We take two horizontal tangents of the character, one at the top and one at the bottom, connect the upper and
the lower mean touching points. The slant of this line defines the slant of the character. One should take into consideration
that several characters like L or k have a negative slant, i.e. to the left. For characters with a large horizontal
extension like '-', determining the slant does not make sense. Let us describe the value italic of a character by construction:
normierte Zeilenhöhe mit 64 Pixel
Take a vertical line and rotate it around its middle point in the given slant. Assume a normalized line height of 64 pixels.
Now measure the distance between the intersections of the vertical and the rotated line at the upper line boundary. This
value, measured in units of pixel width, is delivered under italic. This definition has an advantage against measurement
in degrees: the value can directly be used for slant correction by horizontal shifts. Under bold the mean stroke width of
the character is delivered. It is measured in units of half pixel width. A value of 3 describes a stroke width of 1.5 pixel.
strokelen, black
- strokelen returns the sum of the length of all strokes in the character image. Multiplication with the mean
stroke width bold provides a rough approximation for the (double) number of black pixels in the image. A more precise value
is given under black - the percentage of black pixels in the image (100*black_points/image_points).
rec_char, rec_char2
- For every recognized character or pattern, two characters are returned at this location, dependent on
the selected code page. The first character is usually the related character code, while the second characterizes
form subclasses. For a normal hand printed zero the two describing characters are "
0_". For a slashed hand
printed zero the describing characters are "0W". In ambiguous cases, up to eight alternatives
(REC_ALT) in declining order of confidence are returned. An empty string or blank means "no result" or
"no further alternatives". An overview of all labels and form subclasses of KADMOS is provided in our
website.
rec_char2 has the same meaning as rec_char but the data type is short and it describes
the labels in Unicode.
rec_value
- For each recognized character (and for all alternatives in ambiguous cases) the confidence of
recognition is returned here. One means highest confidence, values above 128 mean least confidence.
rec_top, rec_bottom
-
All recognized alternatives are returned with information where their correct position should be in the current line.
The values are scaled analogous to
image_top and image_bottom, based on the specified
base_line. For a non-specified base_line, a base_line = 64 is assumed.
Reference: