Two different methods to detect the characters are supplied.
All segmentation methods assume that the text is darker than the
background. If this is not the case, please invert the image with
invert_imageinvert_imageInvertImageInvertImageinvert_image.
This method extracts text that differ locally from the
background. Therefore, it is suited for images with
inhomogeneous illumination. The enhancement of the text
borders, leads to a more accurate determination of the
outline of the text. Which is especially useful if the
background is highly textured. The parameter
ContrastContrastContrastcontrastcontrast defines the minimum contrast,i.e.,
the minimum gray value difference between symbols and
background.
'local_auto_shape'
The minimum contrast is estimated automatically such
that the number of very small regions is reduced. This
method is especially suitable for noisy images. The
parameter ThresholdOffsetThresholdOffsetThresholdOffsetthresholdOffsetthreshold_offset can be used to adjust
the threshold.
Let g(x,y) be the gray value at position (x,y) in the
input ImageImageImageimageimage. The threshold condition is
determined by:
DotPrintDotPrintDotPrintdotPrintdot_print:
Should be set to 'true'"true""true""true""true" if dot prints should be read, else to
'false'"false""false""false""false".
CharWidthCharWidthCharWidthcharWidthchar_width:
This can be a tuple with up to three values. The first value is the
average width of a character. The second is the minimum width of a
character and the third is the maximum width of a character.
If the minimum is not set or equal -1, the operator automatically sets
these value depending on the average CharWidthCharWidthCharWidthcharWidthchar_width. The same is
the case if the maximum is not set. Some examples:
[10] sets the average character width to 10, the minimum and
maximum are calculated by the operator.
[10,-1,20] sets the average character width to 10, the minimum value is
calculated by the system, and the maximum is set to 20.
[10,5,20] sets the average character width to 10, the minimum to 5,
and the maximum to 20.
CharHeightCharHeightCharHeightcharHeightchar_height:
This can be a tuple with up to three values. The first value is the
average height of a character. The second is the minimum height of a
character and the third is the maximum height of a character.
If the minimum is not set or equal -1, the operator automatically sets
these value depending on the average CharHeightCharHeightCharHeightcharHeightchar_height. The same is
the case if the maximum is not set. Some examples:
[10] sets the average character height to 10, the minimum and
maximum are calculated by the operator.
[10,-1,20] sets the average character height to 10, the minimum value is
calculated by the system, and the maximum is set to 20.
[10,5,20] this sets the average character height to 10, the minimum to 5,
and the maximum to 20.
ContrastContrastContrastcontrastcontrast:
Defines the minimum contrast between the text and the background. This
parameter is used if the segmentation method 'local_contrast_best'"local_contrast_best""local_contrast_best""local_contrast_best""local_contrast_best"
is selected.
List of values:
'local_auto_shape'"local_auto_shape""local_auto_shape""local_auto_shape""local_auto_shape", 'local_contrast_best'"local_contrast_best""local_contrast_best""local_contrast_best""local_contrast_best"
List of values:
'bold'"bold""bold""bold""bold", 'light'"light""light""light""light", 'medium'"medium""medium""medium""medium", 'ultra_light'"ultra_light""ultra_light""ultra_light""ultra_light"
If the input parameters are set correctly, the operator
segment_characterssegment_charactersSegmentCharactersSegmentCharacterssegment_characters returns the value 2 (
H_MSG_TRUE)
. Otherwise an
exception will be raised.