ImageEn, unit ievision

TIEVisionOCR.getTextAngle

TIEVisionOCR.getTextAngle


Declaration

function getTextAngle(): single; overload; safecall;
function getTextAngle(image: TIEVisionImage): single; overload; safecall;


Description

Returns the text angle (orientation) in radians.
First overload takes last processed image as input.
Second overload takes the specified image as input.

Parameter Description
image Source image

Note:
You must use either getTextAngle or recognize to process the image. Use recognize if you need the text content. Use getTextAngle if you only require the orientation/skew of the image (which skips the text recognition for faster performance)
You should get a better deskew angle using getOrientation
A shortcut method for this is available: OCR_GetOrientation


Example

// Detect orientation
angle := OCR.getTextAngle( ImageEnView1.IEBitmap.GetIEVisionImage() ) * 180 / PI;
ImageEnView1.IEBitmap.Origin := ieboBOTTOMLEFT;
ImageEnView1.Proc.Rotate(-angle);

OCR.getTextAngle() returns -1.56 for the following image (which is -89°):