RecResult, RelResult
typedef struct RelResult_tag {
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;
short rec_wchar[REC_ALT][REC_WCHAR_COUNT];
unsigned char rec_value[REC_ALT];
long rec_top[REC_ALT];
long rec_bottom[REC_ALT];
} RelResult;
#define RecResult RelResult /* we use same data structure in rec_accent() */
Elements:
left, top;
- Character position in the line.
width, height
- Character height and width.
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_...
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_FLAG_ACCENT_TOP | Wird gesetzt wenn der Akzent über dem betreffenden Zeichen steht. |
RESULT_FLAG_ACCENT_BOTTOM | Wird gesetzt wenn der Akzent unter dem betreffenden Zeichen steht. |
RESULT_FLAG_ACCENT | RESULT_FLAG_ACCENT_TOP | RESULT_FLAG_ACCENT_BOTTOM |
RESULT_FLAG_ACCENT_START | Erstes Element eines akzentuierten Zeichens. |
RESULT_FLAG_ACCENT_MEMBER | Element eines akzentuierten Zeichens. |
RESULT_FLAG_ACCENT_END | Letztes Element eines akzentuierten Zeichens. |
*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
- Width and height of
result_image
, it can bee compressed
result_height
- Projection according to the mean slant of the characters of the line from the start and the end of
the character onto the baseline.
projection[2]
- Projection according to the position of the beginning and end of the sign on 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:
- normalized line height of 64 pixels
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_wchar
- Depending on the set code page, under
rec_wchar
, the 2-byte identifier for the associated
character is returned, the result of te recognition. The first character is generally the associated UTF_16 code and
the second characterizes form classes. For example, for a normal handwriting zero the label 0_
will be
delivered and for handwriting zero with a slash the label 0W
.
If the result of the detection is not unique, then up to 8 alternatives are returned in order of decreasing security.
An empty or blanked string means "no result" or "no other alternatives".
An overview of the labels and form classes available in KADMOS with their 2-byte labels is be found on our
website.
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: