text_line_slanttext_line_slantTextLineSlantTextLineSlant (Operator)

Name

text_line_slanttext_line_slantTextLineSlantTextLineSlant — Bestimmen der Neigung von Zeichen einer Textzeile oder eines Textabschnitts.

Signatur

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)

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

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)

Beschreibung

text_line_slanttext_line_slantTextLineSlantTextLineSlantTextLineSlant bestimmt die Neigung der Zeichen einer Textzeile oder eines Textabschnitts.

Der Parameter RegionRegionRegionRegionregion gibt an, in welchem Bereich des Bildes die Textzeilen liegen. Sie dient lediglich zum Einschränken des Verarbeitungsbereichs. Innerhalb dieser Region werden die Grauwerte zur Bestimmung des Neigungswinkels verwendet. Die Textzeilen werden vom Operator selbst segmentiert. Wird mehr als eine Region übergeben, dann werden die Zahlenwerte des Neigungswinkels in einem Tupel abgespeichert, wobei die Position eines Wertes in dem Tupel der Position der Region im Eingabetupel entspricht.

CharHeightCharHeightCharHeightCharHeightcharHeight gibt die ungefähre Höhe der Textzeilen im Bereich RegionRegionRegionRegionregion an. Hierbei wird angenommen, dass die Textzeilen dunkler sind als der Hintergrund.

Durch SlantFromSlantFromSlantFromSlantFromslantFrom und SlantToSlantToSlantToSlantToslantTo kann der Suchbereich eingeschränkt werden, womit auch die Laufzeit von text_line_slanttext_line_slantTextLineSlantTextLineSlantTextLineSlant beinflusst wird.

Mit Hilfe des berechneten Winkels SlantAngleSlantAngleSlantAngleSlantAngleslantAngle und den Operatoren zur affinen Transformation kann die Neigung der Zeichen entfernt werden. Dies vereinfacht möglicherweise die Trennung von Zeichen für OCR-Anwendungen. Damit das Verfahren funktioniert, müssen alle Zeichen einer Region eine ähnliche Neigung besitzen.

Ausführungsinformationen

Parameter

RegionRegionRegionRegionregion (input_object)  region(-array) objectHRegionHRegionHobject

Bildbereich der Textzeilen.

ImageImageImageImageimage (input_object)  singlechannelimage objectHImageHImageHobject (byte / uint2)

Eingabebild.

CharHeightCharHeightCharHeightCharHeightcharHeight (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Höhe der Textzeilen.

Defaultwert: 25

Typischer Wertebereich: 1 ≤ CharHeight CharHeight CharHeight CharHeight charHeight

Restriktion: CharHeight >= 1

SlantFromSlantFromSlantFromSlantFromslantFrom (input_control)  angle.rad HTupleHTupleHtuple (real) (double) (double) (double)

Minimale Neigung der Zeichen

Defaultwert: -0.523599

Typischer Wertebereich: -0.785398 ≤ SlantFrom SlantFrom SlantFrom SlantFrom slantFrom ≤ 0.785398

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

SlantToSlantToSlantToSlantToslantTo (input_control)  angle.rad HTupleHTupleHtuple (real) (double) (double) (double)

Maximale Neigung der Zeichen

Defaultwert: 0.523599

Typischer Wertebereich: -0.785398 ≤ SlantTo SlantTo SlantTo SlantTo slantTo ≤ 0.785398

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

SlantAngleSlantAngleSlantAngleSlantAngleslantAngle (output_control)  angle.rad(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Berechnete Neigungswinkel der Zeichen in der Region

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

Ergebnis

Sind die Eingabeparameter korrekt besetzt, dann liefert text_line_slanttext_line_slantTextLineSlantTextLineSlantTextLineSlant den Wert 2 (H_MSG_TRUE). Andernfalls wird eine Fehlerbehandlung durchgeführt.

Nachfolger

hom_mat2d_slanthom_mat2d_slantHomMat2dSlantHomMat2dSlantHomMat2dSlant, affine_trans_imageaffine_trans_imageAffineTransImageAffineTransImageAffineTransImage, affine_trans_image_sizeaffine_trans_image_sizeAffineTransImageSizeAffineTransImageSizeAffineTransImageSize

Modul

Foundation