text_line_slanttext_line_slantTextLineSlantTextLineSlanttext_line_slant (Operator)

Name

text_line_slanttext_line_slantTextLineSlantTextLineSlanttext_line_slant — 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)

def text_line_slant(region: HObject, image: HObject, char_height: int, slant_from: float, slant_to: float) -> Sequence[float]

def text_line_slant_s(region: HObject, image: HObject, char_height: int, slant_from: float, slant_to: float) -> float

Beschreibung

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

Der Parameter RegionRegionRegionRegionregionregion 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.

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

Durch SlantFromSlantFromSlantFromSlantFromslantFromslant_from und SlantToSlantToSlantToSlantToslantToslant_to kann der Suchbereich eingeschränkt werden, womit auch die Laufzeit von text_line_slanttext_line_slantTextLineSlantTextLineSlantTextLineSlanttext_line_slant beinflusst wird.

Mit Hilfe des berechneten Winkels SlantAngleSlantAngleSlantAngleSlantAngleslantAngleslant_angle 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

RegionRegionRegionRegionregionregion (input_object)  region(-array) objectHRegionHObjectHRegionHobject

Bildbereich der Textzeilen.

ImageImageImageImageimageimage (input_object)  singlechannelimage objectHImageHObjectHImageHobject (byte / uint2)

Eingabebild.

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

Höhe der Textzeilen.

Defaultwert: 25

Typischer Wertebereich: 1 ≤ CharHeight CharHeight CharHeight CharHeight charHeight char_height

Restriktion: CharHeight >= 1

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

Minimale Neigung der Zeichen

Defaultwert: -0.523599

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

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

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

Maximale Neigung der Zeichen

Defaultwert: 0.523599

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

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

SlantAngleSlantAngleSlantAngleSlantAngleslantAngleslant_angle (output_control)  angle.rad(-array) HTupleSequence[float]HTupleHtuple (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_slantTextLineSlantTextLineSlantTextLineSlanttext_line_slant den Wert TRUE. Andernfalls wird eine Fehlerbehandlung durchgeführt.

Nachfolger

hom_mat2d_slanthom_mat2d_slantHomMat2dSlantHomMat2dSlantHomMat2dSlanthom_mat2d_slant, affine_trans_imageaffine_trans_imageAffineTransImageAffineTransImageAffineTransImageaffine_trans_image, affine_trans_image_sizeaffine_trans_image_sizeAffineTransImageSizeAffineTransImageSizeAffineTransImageSizeaffine_trans_image_size

Modul

Foundation