text_line_orientation — 确定文本行或段落的方向。
text_line_orientation(Region, Image : : CharHeight, OrientationFrom, OrientationTo : OrientationAngle)
text_line_orientation 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
OrientationFrom and OrientationTo should be in the interval
from -pi/4 to pi/4.
The parameter Region specifies the area of the image in which the
text lines are located. The Region 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_orientation
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.
CharHeight specifies the approximately height of the existing text
lines in the region Region. It's assumed, that the text lines are
darker than the background.
The search area can be restricted by the parameters OrientationFrom
and OrientationTo, whereby also the runtime of the operator is
influenced.
With the calculated angle OrientationAngle and operators like
affine_trans_image, the region Region of the image
Image can be rotated such, that the text lines lie horizontally
in the image. This may simplify the character segmentation for OCR
applications.
Region (输入对象) region(-array) → object
Area of text lines.
Image (输入对象) singlechannelimage → object (byte / uint2)
输入图像。
CharHeight (输入控制) integer → (integer)
Height of the text lines.
默认值: 25
值范围:
1
≤
CharHeight
限制:
CharHeight >= 1
OrientationFrom (输入控制) angle.rad → (real)
Minimum rotation of the text lines.
默认值: -0.523599
值范围:
-3.141593
≤
OrientationFrom
≤
3.141593
限制:
OrientationFrom <= OrientationTo
OrientationTo (输入控制) angle.rad → (real)
Maximum rotation of the text lines.
默认值: 0.523599
值范围:
-3.141593
≤
OrientationTo
≤
3.141593
限制:
OrientationFrom <= OrientationTo && OrientationTo < OrientationFrom + pi
OrientationAngle (输出控制) angle.rad(-array) → (real)
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_orientation 返回值 2 ( H_MSG_TRUE )。否则将抛出异常。
rotate_image,
affine_trans_image,
affine_trans_image_size
基础