Name
text_line_orientationtext_line_orientationTextLineOrientationtext_line_orientationTextLineOrientationTextLineOrientation — Determines the orientation of a text line or paragraph.
Herror text_line_orientation(const Hobject Region, const Hobject Image, const Hlong CharHeight, double OrientationFrom, double OrientationTo, double* OrientationAngle)
Herror T_text_line_orientation(const Hobject Region, const Hobject Image, const Htuple CharHeight, const Htuple OrientationFrom, const Htuple OrientationTo, Htuple* OrientationAngle)
Herror text_line_orientation(Hobject Region, Hobject Image, const HTuple& CharHeight, const HTuple& OrientationFrom, const HTuple& OrientationTo, double* OrientationAngle)
Herror text_line_orientation(Hobject Region, Hobject Image, const HTuple& CharHeight, const HTuple& OrientationFrom, const HTuple& OrientationTo, HTuple* OrientationAngle)
double HRegion::TextLineOrientation(const HImage& Image, const HTuple& CharHeight, const HTuple& OrientationFrom, const HTuple& OrientationTo) const
HTuple HRegionArray::TextLineOrientation(const HImage& Image, const HTuple& CharHeight, const HTuple& OrientationFrom, const HTuple& OrientationTo) const
text_line_orientationtext_line_orientationTextLineOrientationtext_line_orientationTextLineOrientationTextLineOrientation determines the orientation of a single text
line or a paragraph in relation to the horizontal image axis. If the
orientation of a single text line should be determined, the range for the
OrientationFromOrientationFromOrientationFromOrientationFromOrientationFromorientationFrom and OrientationToOrientationToOrientationToOrientationToOrientationToorientationTo should be in the interval
from -pi/4 to pi/4.
The parameter RegionRegionRegionRegionRegionregion specifies the area of the image in which the
text lines are located. The RegionRegionRegionRegionRegionregion is only used to reduce the
working area. To determine the slant, the gray values inside that area
are used.
The text lines are segmented by the operator text_line_orientationtext_line_orientationTextLineOrientationtext_line_orientationTextLineOrientationTextLineOrientation
itself. If more than one region is passed, the numerical values of the
orientation angle are stored in a tuple, the position of a value in the
tuple corresponding to the position of the region in the input tuple.
CharHeightCharHeightCharHeightCharHeightCharHeightcharHeight specifies the approximately height of the existing text
lines in the region RegionRegionRegionRegionRegionregion. It's assumed, that the text lines are
darker than the background.
The search area can be restricted by the parameters OrientationFromOrientationFromOrientationFromOrientationFromOrientationFromorientationFrom
and OrientationToOrientationToOrientationToOrientationToOrientationToorientationTo, whereby also the runtime of the operator is
influenced.
With the calculated angle OrientationAngleOrientationAngleOrientationAngleOrientationAngleOrientationAngleorientationAngle and operators like
affine_trans_imageaffine_trans_imageAffineTransImageaffine_trans_imageAffineTransImageAffineTransImage, the region RegionRegionRegionRegionRegionregion of the image
ImageImageImageImageImageimage can be rotated such, that the text lines lie horizontally
in the image. This may simplify the character segmentation for OCR
applications.
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on tuple level.
Height of the text lines.
Default value: 25
Typical range of values: 1
≤
CharHeight
CharHeight
CharHeight
CharHeight
CharHeight
charHeight
Restriction: CharHeight >= 1
Minimum rotation of the text lines.
Default value: -0.523599
Typical range of values: -3.141593
≤
OrientationFrom
OrientationFrom
OrientationFrom
OrientationFrom
OrientationFrom
orientationFrom
≤
3.141593
Restriction: -2 * pi <= OrientationFrom <= 2 * pi
Maximum rotation of the text lines.
Default value: 0.523599
Typical range of values: -3.141593
≤
OrientationTo
OrientationTo
OrientationTo
OrientationTo
OrientationTo
orientationTo
≤
3.141593
Restriction: OrientationFrom <= OrientationTo && OrientationTo < OrientationFrom + pi
Calculated rotation angle of the text lines.
read_image(Image,'letters')
text_line_orientation(Image,Image,50,rad(-80),rad(80),OrientationAngle)
rotate_image(Image,ImageRotate,-OrientationAngle/rad(180)*180,'constant')
If the input parameters are set correctly, the operator
text_line_orientationtext_line_orientationTextLineOrientationtext_line_orientationTextLineOrientationTextLineOrientation returns the value 2 (H_MSG_TRUE).
Otherwise an exception will be raised.
rotate_imagerotate_imageRotateImagerotate_imageRotateImageRotateImage,
affine_trans_imageaffine_trans_imageAffineTransImageaffine_trans_imageAffineTransImageAffineTransImage,
affine_trans_image_sizeaffine_trans_image_sizeAffineTransImageSizeaffine_trans_image_sizeAffineTransImageSizeAffineTransImageSize
Foundation