text_line_slant — Determines the slant of characters of a text line or paragraph.
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.
Area of text lines.
Height of the text lines.
Default value: 25
Typical range of values: 1 ≤ CharHeight
Restriction: CharHeight >= 1
Minimum slant of the characters
Default value: -0.523599
Typical range of values: -0.785398 ≤ SlantFrom ≤ 0.785398
Restriction: - pi / 4 <= SlantFrom && SlantFrom <= SlantTo
Maximum slant of the characters
Default value: 0.523599
Typical range of values: -0.785398 ≤ SlantTo ≤ 0.785398
Restriction: - pi / 4 <= SlantTo && SlantTo <= pi / 4
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 returns the value 2 (H_MSG_TRUE). Otherwise an exception will be raised.
hom_mat2d_slant, affine_trans_image, affine_trans_image_size