Name
segment_charactersT_segment_charactersSegmentCharacterssegment_charactersSegmentCharactersSegmentCharacters — Segments characters in a given region of an image.
Herror T_segment_characters(const Hobject Region, const Hobject Image, Hobject* ImageForeground, Hobject* RegionForeground, const Htuple Method, const Htuple EliminateLines, const Htuple DotPrint, const Htuple StrokeWidth, const Htuple CharWidth, const Htuple CharHeight, const Htuple ThresholdOffset, const Htuple Contrast, Htuple* UsedThreshold)
Herror segment_characters(Hobject Region, Hobject Image, Hobject* ImageForeground, Hobject* RegionForeground, const HTuple& Method, const HTuple& EliminateLines, const HTuple& DotPrint, const HTuple& StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, const HTuple& ThresholdOffset, const HTuple& Contrast, Hlong* UsedThreshold)
Herror segment_characters(Hobject Region, Hobject Image, Hobject* ImageForeground, Hobject* RegionForeground, const HTuple& Method, const HTuple& EliminateLines, const HTuple& DotPrint, const HTuple& StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, const HTuple& ThresholdOffset, const HTuple& Contrast, HTuple* UsedThreshold)
HImage HRegion::SegmentCharacters(const HImage& Image, HRegion* RegionForeground, const HTuple& Method, const HTuple& EliminateLines, const HTuple& DotPrint, const HTuple& StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, const HTuple& ThresholdOffset, const HTuple& Contrast, Hlong* UsedThreshold) const
HImageArray HRegionArray::SegmentCharacters(const HImage& Image, HRegionArray* RegionForeground, const HTuple& Method, const HTuple& EliminateLines, const HTuple& DotPrint, const HTuple& StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, const HTuple& ThresholdOffset, const HTuple& Contrast, HTuple* UsedThreshold) const
void SegmentCharacters(const HObject& Region, const HObject& Image, HObject* ImageForeground, HObject* RegionForeground, const HTuple& Method, const HTuple& EliminateLines, const HTuple& DotPrint, const HTuple& StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, const HTuple& ThresholdOffset, const HTuple& Contrast, HTuple* UsedThreshold)
HImage HRegion::SegmentCharacters(const HImage& Image, HRegion* RegionForeground, const HString& Method, const HString& EliminateLines, const HString& DotPrint, const HString& StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, Hlong ThresholdOffset, Hlong Contrast, HTuple* UsedThreshold) const
HImage HRegion::SegmentCharacters(const HImage& Image, HRegion* RegionForeground, const HString& Method, const HString& EliminateLines, const HString& DotPrint, const HString& StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, Hlong ThresholdOffset, Hlong Contrast, Hlong* UsedThreshold) const
HImage HRegion::SegmentCharacters(const HImage& Image, HRegion* RegionForeground, const char* Method, const char* EliminateLines, const char* DotPrint, const char* StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, Hlong ThresholdOffset, Hlong Contrast, Hlong* UsedThreshold) const
void HOperatorSetX.SegmentCharacters(
[in] IHUntypedObjectX* Region, [in] IHUntypedObjectX* Image, [out] IHUntypedObjectX** ImageForeground, [out] IHUntypedObjectX** RegionForeground, [in] VARIANT Method, [in] VARIANT EliminateLines, [in] VARIANT DotPrint, [in] VARIANT StrokeWidth, [in] VARIANT CharWidth, [in] VARIANT CharHeight, [in] VARIANT ThresholdOffset, [in] VARIANT Contrast, [out] VARIANT* UsedThreshold)
IHImageX* HRegionX.SegmentCharacters(
[in] IHImageX* Image, [out] IHRegionX** RegionForeground, [in] BSTR Method, [in] BSTR EliminateLines, [in] BSTR DotPrint, [in] BSTR StrokeWidth, [in] VARIANT CharWidth, [in] VARIANT CharHeight, [in] Hlong ThresholdOffset, [in] Hlong Contrast, [out] VARIANT* UsedThreshold)
static void HOperatorSet.SegmentCharacters(HObject region, HObject image, out HObject imageForeground, out HObject regionForeground, HTuple method, HTuple eliminateLines, HTuple dotPrint, HTuple strokeWidth, HTuple charWidth, HTuple charHeight, HTuple thresholdOffset, HTuple contrast, out HTuple usedThreshold)
HImage HRegion.SegmentCharacters(HImage image, out HRegion regionForeground, string method, string eliminateLines, string dotPrint, string strokeWidth, HTuple charWidth, HTuple charHeight, int thresholdOffset, int contrast, out HTuple usedThreshold)
HImage HRegion.SegmentCharacters(HImage image, out HRegion regionForeground, string method, string eliminateLines, string dotPrint, string strokeWidth, HTuple charWidth, HTuple charHeight, int thresholdOffset, int contrast, out int usedThreshold)
This operator is used to segment characters in a given RegionRegionRegionRegionRegionregion of an
ImageImageImageImageImageimage. The RegionRegionRegionRegionRegionregion is only used to reduce the working area.
The segmented characters are returned in RegionForegroundRegionForegroundRegionForegroundRegionForegroundRegionForegroundregionForeground.
Two different methods to detect the characters are supplied.
All segmentation methods assume that the text ist darker than the
background. If this is not the case, please invert the image with
invert_imageinvert_imageInvertImageinvert_imageInvertImageInvertImage.
The parameter MethodMethodMethodMethodMethodmethod determines the algorithm for text
segmentation. The possible values are
- 'local_contrast_best'
-
This method extracts text that differ locally from the
background. Therefore, it is suited for images with
inhomogeneous illumination. The enhancment of the text
borders, leads to a more accurate determinaton of the
outline of the text. Which is especially useful if the
background is highly textured. The parameter
ContrastContrastContrastContrastContrastcontrast defines the minimum contrast,i.e.,
the minimum gray value difference between symobls 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 ThresholdOffsetThresholdOffsetThresholdOffsetThresholdOffsetThresholdOffsetthresholdOffset can be used to adjust
the threshold.
Let g(x,y) be the gray value at position (x,y) in the
input ImageImageImageImageImageimage. The threshold condition is
determined by:
g(x,y) <= UsedThresholdUsedThresholdUsedThresholdUsedThresholdUsedThresholdusedThreshold + ThresholdOffsetThresholdOffsetThresholdOffsetThresholdOffsetThresholdOffsetthresholdOffset.
Select EliminateLinesEliminateLinesEliminateLinesEliminateLinesEliminateLineseliminateLines if the extraction of characters is disturbed
by lines that are horizontal or vertical with respect to the lines of
text and set its value to 'true'. The elimination is influenced by the
maximum of CharWidthCharWidthCharWidthCharWidthCharWidthcharWidth and the maximum of CharHeightCharHeightCharHeightCharHeightCharHeightcharHeight.
For further information see the description of these parameters.
DotPrintDotPrintDotPrintDotPrintDotPrintdotPrint:
Should be set to 'true' if dot prints should be read, else to 'false'.
StrokeWidthStrokeWidthStrokeWidthStrokeWidthStrokeWidthstrokeWidth:
Specifies the stroke width of the text. It is used to calculate internally
used mask sizes to determine the characters. This mask sizes are also
influenced through the parameters DotPrintDotPrintDotPrintDotPrintDotPrintdotPrint, the average
CharWidthCharWidthCharWidthCharWidthCharWidthcharWidth, and the average CharHeightCharHeightCharHeightCharHeightCharHeightcharHeight.
CharWidthCharWidthCharWidthCharWidthCharWidthcharWidth:
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 CharWidthCharWidthCharWidthCharWidthCharWidthcharWidth. 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.
CharHeightCharHeightCharHeightCharHeightCharHeightcharHeight:
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 CharHeightCharHeightCharHeightCharHeightCharHeightcharHeight. 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.
ThresholdOffsetThresholdOffsetThresholdOffsetThresholdOffsetThresholdOffsetthresholdOffset:
This parameter can be used to adjust the threshold, which is used when the
segmentation method 'local_auto_shape'"local_auto_shape""local_auto_shape""local_auto_shape""local_auto_shape""local_auto_shape" is chosen.
ContrastContrastContrastContrastContrastcontrast:
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""local_contrast_best"
is selected.
UsedThresholdUsedThresholdUsedThresholdUsedThresholdUsedThresholdusedThreshold:
After the execution, this parameter returns the threshold used to
segment the characters.
ImageForegroundImageForegroundImageForegroundImageForegroundImageForegroundimageForeground returns the image that was internally used for the
segmentation.
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on tuple level.
Area in the image where the text lines are located.
Image used for the segmentation.
Method to segment the characters.
Default value:
'local_auto_shape'
"local_auto_shape"
"local_auto_shape"
"local_auto_shape"
"local_auto_shape"
"local_auto_shape"
List of values: 'local_auto_shape'"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""local_contrast_best"
Eliminate horizontal and vertical lines?
Default value:
'false'
"false"
"false"
"false"
"false"
"false"
List of values: 'false'"false""false""false""false""false", 'true'"true""true""true""true""true"
Should dot print characters be detected?
Default value:
'false'
"false"
"false"
"false"
"false"
"false"
List of values: 'false'"false""false""false""false""false", 'true'"true""true""true""true""true"
Stroke width of a character.
Default value:
'medium'
"medium"
"medium"
"medium"
"medium"
"medium"
List of values: 'bold'"bold""bold""bold""bold""bold", 'light'"light""light""light""light""light", 'medium'"medium""medium""medium""medium""medium", 'ultra_light'"ultra_light""ultra_light""ultra_light""ultra_light""ultra_light"
Width of a character.
Default value: 25
Typical range of values: 1
≤
CharWidth
CharWidth
CharWidth
CharWidth
CharWidth
charWidth
Restriction: CharWidth >= 1
Height of a character.
Default value: 25
Typical range of values: 1
≤
CharHeight
CharHeight
CharHeight
CharHeight
CharHeight
charHeight
Restriction: CharHeight >= 1
Value to adjust the segmentation.
Default value: 0
Minimum gray value difference between text and
background.
Default value: 10
Typical range of values: 1
≤
Contrast
Contrast
Contrast
Contrast
Contrast
contrast
Restriction: Contrast >= 1
Threshold used to segment the characters.
read_image (Image, 'dot_print_rotated/dot_print_rotated_'+J$'02d')
text_line_orientation (Image, Image, 50, rad(-30), rad(30), OrientationAngle)
rotate_image (Image, ImageRotate, -OrientationAngle/rad(180)*180, 'constant')
segment_characters (ImageRotate, ImageRotate, ImageForeground, \
RegionForeground, 'local_auto_shape', 0, 0, 'medium', \
25, 25, 0, 10, UsedThreshold)
If the input parameters are set correctly, the operator
segment_characterssegment_charactersSegmentCharacterssegment_charactersSegmentCharactersSegmentCharacters returns the value 2 (H_MSG_TRUE). Otherwise an
exception will be raised.
text_line_orientationtext_line_orientationTextLineOrientationtext_line_orientationTextLineOrientationTextLineOrientation
select_charactersselect_charactersSelectCharactersselect_charactersSelectCharactersSelectCharacters,
connectionconnectionConnectionconnectionConnectionConnection
thresholdthresholdThresholdthresholdThresholdThreshold
Foundation