ClassesClassesClassesClasses | | | | Operators

text_line_slanttext_line_slantTextLineSlanttext_line_slantTextLineSlantTextLineSlant (Operator)

Name

text_line_slanttext_line_slantTextLineSlanttext_line_slantTextLineSlantTextLineSlant — Determines the slant of characters of a text line or paragraph.

Signature

text_line_slant(Region, Image : : CharHeight, SlantFrom, SlantTo : SlantAngle)

Herror text_line_slant(const Hobject Region, const Hobject Image, const Hlong CharHeight, double SlantFrom, double SlantTo, double* SlantAngle)

Herror T_text_line_slant(const Hobject Region, const Hobject Image, const Htuple CharHeight, const Htuple SlantFrom, const Htuple SlantTo, Htuple* SlantAngle)

Herror text_line_slant(Hobject Region, Hobject Image, const HTuple& CharHeight, const HTuple& SlantFrom, const HTuple& SlantTo, double* SlantAngle)

Herror text_line_slant(Hobject Region, Hobject Image, const HTuple& CharHeight, const HTuple& SlantFrom, const HTuple& SlantTo, HTuple* SlantAngle)

double HRegion::TextLineSlant(const HImage& Image, const HTuple& CharHeight, const HTuple& SlantFrom, const HTuple& SlantTo) const

HTuple HRegionArray::TextLineSlant(const HImage& Image, const HTuple& CharHeight, const HTuple& SlantFrom, const HTuple& SlantTo) const

void TextLineSlant(const HObject& Region, const HObject& Image, const HTuple& CharHeight, const HTuple& SlantFrom, const HTuple& SlantTo, HTuple* SlantAngle)

HTuple HRegion::TextLineSlant(const HImage& Image, Hlong CharHeight, double SlantFrom, double SlantTo) const

void HOperatorSetX.TextLineSlant(
[in] IHUntypedObjectX* Region, [in] IHUntypedObjectX* Image, [in] VARIANT CharHeight, [in] VARIANT SlantFrom, [in] VARIANT SlantTo, [out] VARIANT* SlantAngle)

VARIANT HRegionX.TextLineSlant(
[in] IHImageX* Image, [in] Hlong CharHeight, [in] double SlantFrom, [in] double SlantTo)

static void HOperatorSet.TextLineSlant(HObject region, HObject image, HTuple charHeight, HTuple slantFrom, HTuple slantTo, out HTuple slantAngle)

HTuple HRegion.TextLineSlant(HImage image, int charHeight, double slantFrom, double slantTo)

Description

text_line_slanttext_line_slantTextLineSlanttext_line_slantTextLineSlantTextLineSlant determines the slant of a single text line or a paragraph.

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_slanttext_line_slantTextLineSlanttext_line_slantTextLineSlantTextLineSlant 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 high 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 SlantFromSlantFromSlantFromSlantFromSlantFromslantFrom and SlantToSlantToSlantToSlantToSlantToslantTo, whereby also the runtime of the operator is influenced.

With the calculated slant angle SlantAngleSlantAngleSlantAngleSlantAngleSlantAngleslantAngle 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.

Parallelization

Parameters

RegionRegionRegionRegionRegionregion (input_object)  region(-array) objectHRegionHRegionHRegionHRegionXHobject

Area of text lines.

ImageImageImageImageImageimage (input_object)  singlechannelimage objectHImageHImageHImageHImageXHobject (byte / uint2)

Input image.

CharHeightCharHeightCharHeightCharHeightCharHeightcharHeight (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Height of the text lines.

Default value: 25

Typical range of values: 1 ≤ CharHeight CharHeight CharHeight CharHeight CharHeight charHeight

Restriction: CharHeight >= 1

SlantFromSlantFromSlantFromSlantFromSlantFromslantFrom (input_control)  angle.rad HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Minimum slant of the characters

Default value: -0.523599

Typical range of values: -0.785398 ≤ SlantFrom SlantFrom SlantFrom SlantFrom SlantFrom slantFrom ≤ 0.785398

Restriction: - pi / 4 <= SlantFrom && SlantFrom <= SlantTo

SlantToSlantToSlantToSlantToSlantToslantTo (input_control)  angle.rad HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Maximum slant of the characters

Default value: 0.523599

Typical range of values: -0.785398 ≤ SlantTo SlantTo SlantTo SlantTo SlantTo slantTo ≤ 0.785398

Restriction: - pi / 4 <= SlantTo && SlantTo <= pi / 4

SlantAngleSlantAngleSlantAngleSlantAngleSlantAngleslantAngle (output_control)  angle.rad(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Calculated slant of the characters in the region

Example (HDevelop)

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')

Result

If the input parameters are set correctly, the operator text_line_slanttext_line_slantTextLineSlanttext_line_slantTextLineSlantTextLineSlant returns the value 2 (H_MSG_TRUE). Otherwise an exception will be raised.

Possible Successors

hom_mat2d_slanthom_mat2d_slantHomMat2dSlanthom_mat2d_slantHomMat2dSlantHomMat2dSlant, affine_trans_imageaffine_trans_imageAffineTransImageaffine_trans_imageAffineTransImageAffineTransImage, affine_trans_image_sizeaffine_trans_image_sizeAffineTransImageSizeaffine_trans_image_sizeAffineTransImageSizeAffineTransImageSize

Module

Foundation


ClassesClassesClassesClasses | | | | Operators