text_line_slant — 确定文本行或段落的字符倾斜度。
text_line_slant(Region, Image : : CharHeight, SlantFrom, SlantTo : SlantAngle)
text_line_slant determines the slant of a single text line or a
paragraph.
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_slant 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 high 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 SlantFrom and
SlantTo, whereby also the runtime of the operator is influenced.
With the calculated slant angle SlantAngle and operators for
affine transformations, the slant can be removed from the characters. This
may simplify the character separation for OCR applications. To work
correctly all characters of a region should have nearly the same slant.
Region (输入对象) region(-array) → object
Area of text lines.
Image (输入对象) singlechannelimage → object (byte / uint2)
输入图像。
CharHeight (输入控制) integer → (integer)
Height of the text lines.
默认值: 25
值范围:
1
≤
CharHeight
SlantFrom (输入控制) angle.rad → (real)
Minimum slant of the characters
默认值: -0.523599
值范围:
-0.785398
≤
SlantFrom
≤
0.785398
限制:
SlantFrom <= SlantTo
SlantTo (输入控制) angle.rad → (real)
Maximum slant of the characters
默认值: 0.523599
值范围:
-0.785398
≤
SlantTo
≤
0.785398
限制:
SlantFrom <= SlantTo
SlantAngle (输出控制) angle.rad(-array) → (real)
Calculated slant of the characters in the region
hom_mat2d_identity(HomMat2DIdentity) read_image(Image,'dot_print_slanted') * correct slant text_line_slant(Image,Image,50,rad(-45),rad(45),SlantAngle) hom_mat2d_slant(HomMat2DIdentity,-SlantAngle,'x',0,0,HomMat2DSlant) affine_trans_image(Image,Image,HomMat2DSlant,'constant','true')
If the input parameters are set correctly, the operator
text_line_slant 返回值 2 ( H_MSG_TRUE )。否则将抛出异常。
hom_mat2d_slant,
affine_trans_image,
affine_trans_image_size
基础