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;
#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];
} RelResult;
#define RecResult RelResult
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:
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: