text_line_orientationtext_line_orientationTextLineOrientationTextLineOrientationtext_line_orientation (算子名称)

名称

text_line_orientationtext_line_orientationTextLineOrientationTextLineOrientationtext_line_orientation — Determines the orientation of a text line or paragraph.

参数签名

text_line_orientation(区域, Image : : CharHeight, OrientationFrom, OrientationTo : OrientationAngle)

Herror text_line_orientation(const Hobject 区域, const Hobject Image, const Hlong CharHeight, double OrientationFrom, double OrientationTo, double* OrientationAngle)

Herror T_text_line_orientation(const Hobject 区域, const Hobject Image, const Htuple CharHeight, const Htuple OrientationFrom, const Htuple OrientationTo, Htuple* OrientationAngle)

void TextLineOrientation(const HObject& 区域, const HObject& Image, const HTuple& CharHeight, const HTuple& OrientationFrom, const HTuple& OrientationTo, HTuple* OrientationAngle)

HTuple HRegion::TextLineOrientation(const HImage& Image, Hlong CharHeight, double OrientationFrom, double OrientationTo) const

static void HOperatorSet.TextLineOrientation(HObject 区域, HObject image, HTuple charHeight, HTuple orientationFrom, HTuple orientationTo, out HTuple orientationAngle)

HTuple HRegion.TextLineOrientation(HImage image, int charHeight, double orientationFrom, double orientationTo)

def text_line_orientation(区域: HObject, image: HObject, char_height: int, orientation_from: float, orientation_to: float) -> Sequence[float]

def text_line_orientation_s(区域: HObject, image: HObject, char_height: int, orientation_from: float, orientation_to: float) -> float

描述

text_line_orientationtext_line_orientationTextLineOrientationTextLineOrientationTextLineOrientationtext_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 OrientationFromOrientationFromOrientationFromOrientationFromorientationFromorientation_from and OrientationToOrientationToOrientationToOrientationToorientationToorientation_to should be in the interval from -pi/4 to pi/4.

The parameter 区域区域区域区域区域区域 specifies the area of the image in which the text lines are located. The 区域区域区域区域区域区域 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_orientationTextLineOrientationTextLineOrientationTextLineOrientationtext_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.

CharHeightCharHeightCharHeightCharHeightcharHeightchar_height specifies the approximately height of the existing text lines in the region 区域区域区域区域区域区域. It's assumed, that the text lines are darker than the background.

The search area can be restricted by the parameters OrientationFromOrientationFromOrientationFromOrientationFromorientationFromorientation_from and OrientationToOrientationToOrientationToOrientationToorientationToorientation_to, whereby also the runtime of the operator is influenced.

With the calculated angle OrientationAngleOrientationAngleOrientationAngleOrientationAngleorientationAngleorientation_angle and operators like affine_trans_imageaffine_trans_imageAffineTransImageAffineTransImageAffineTransImageaffine_trans_image, the region 区域区域区域区域区域区域 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.

运行信息

参数表

区域区域区域区域区域区域 (input_object)  region(-array) objectHRegionHObjectHRegionHobject

Area of text lines.

ImageImageImageImageimageimage (input_object)  singlechannelimage objectHImageHObjectHImageHobject (byte / uint2)

Input image.

CharHeightCharHeightCharHeightCharHeightcharHeightchar_height (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of the text lines.

Default: 25

Value range: 1 ≤ CharHeight CharHeight CharHeight CharHeight charHeight char_height

Restriction: CharHeight >= 1

OrientationFromOrientationFromOrientationFromOrientationFromorientationFromorientation_from (input_control)  angle.rad HTuplefloatHTupleHtuple (real) (double) (double) (double)

Minimum rotation of the text lines.

Default: -0.523599

Value range: -3.141593 ≤ OrientationFrom OrientationFrom OrientationFrom OrientationFrom orientationFrom orientation_from ≤ 3.141593

Restriction: OrientationFrom <= OrientationTo

OrientationToOrientationToOrientationToOrientationToorientationToorientation_to (input_control)  angle.rad HTuplefloatHTupleHtuple (real) (double) (double) (double)

Maximum rotation of the text lines.

Default: 0.523599

Value range: -3.141593 ≤ OrientationTo OrientationTo OrientationTo OrientationTo orientationTo orientation_to ≤ 3.141593

Restriction: OrientationFrom <= OrientationTo && OrientationTo < OrientationFrom + pi

OrientationAngleOrientationAngleOrientationAngleOrientationAngleorientationAngleorientation_angle (output_control)  angle.rad(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Calculated rotation angle of the text lines.

例程 (HDevelop)

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_orientationTextLineOrientationTextLineOrientationTextLineOrientationtext_line_orientation returns the value 2 ( H_MSG_TRUE) . Otherwise an exception will be raised.

可能的后置算子

rotate_imagerotate_imageRotateImageRotateImageRotateImagerotate_image, affine_trans_imageaffine_trans_imageAffineTransImageAffineTransImageAffineTransImageaffine_trans_image, affine_trans_image_sizeaffine_trans_image_sizeAffineTransImageSizeAffineTransImageSizeAffineTransImageSizeaffine_trans_image_size

模块

Foundation