ImageEn, unit imageenproc

TImageEnProc.CalcOrientation

TImageEnProc.CalcOrientation

Declaration

function CalcOrientation(): Integer;

Description

Find the correct orientation for a textual image. It is mainly used to detect whether to adjust a document from portrait to landscape.
It will return either 0 (document is correctly oriented) or 90 (image is right-rotated and should be rotated 90° CCW.
CalcOrientation uses an algorithm that is based on histogram density, without understanding the content of the document. It can only detect 0° or 90° orientation. It cannot detect documents that are inverted, and will give an inaccurate result (90) for documents that are left-rotated.
For more accurate orientation detection, use: getOrientation.

Note:
Only suitable for document images (images that contain only text)
The PixelFormat for the image must be ie1g, ie24RGB or ie32RGB. Other formats will return 0

Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr

Example

// Load test image
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );



// Automatically rotate a document
n := ImageEnView1.Proc.CalcOrientation();
ImageEnView1.Proc.Rotate( n );


See Also

SkewDetectionFine
SkewDetection
getOrientation
getTextAngle
OCR_GetOrientation