Skip to main content
This method detects text orientation on the image. The method returns TextOrientation object, if orientation has been detected successfully, and NULL, if the program failed to detect orientation.

Syntax

C++

HRESULT DetectOrientation(
  IObjectsExtractionParams*    ExtractionParams,
  IRecognizerParams*           RecognizerParams,
  ITextOrientation**           Result
);

C#

ITextOrientation DetectOrientation(
  IObjectsExtractionParams    ExtractionParams,
  IRecognizerParams           RecognizerParams
);

Visual Basic .NET

Function DetectOrientation( _
  [ExtractionParams As IObjectsExtractionParams = Nothing], _
  [RecognizerParams As IRecognizerParams = Nothing] _
) As ITextOrientation

Parameters

ExtractionParams [in] This variable refers to the ObjectsExtractionParams object that stores parameters of objects extraction. This parameter may be 0. In this case, the objects are extracted with default parameters, or, if a profile has been loaded, the parameters set by this profile are used. RecognizerParams [in] This variable refers to the RecognizerParams object that stores parameters of page recognition. This parameter may be 0. In this case, the default parameters are used, or, if a profile has been loaded, the parameters set by this profile are used. Result [out, retval] A pointer to ITextOrientation* pointer variable that receives the interface pointer of the TextOrientation output object. This object provides access to the text orientation on the page. If orientation detection failed, NULL is returned.

Return values

This method has no specific return values. It returns the standard return values of ABBYY FineReader Engine functions.

Samples

FREngine.IFRDocument frdoc;
// We presume that the document has been created and images have been added to it
// Get orientation of every page in the document
int pagesCount = frDoc.Pages.Count;
FREngine.RotationTypeEnum[] rotations = new FREngine.RotationTypeEnum[pagesCount];
for (int i = 0; i < pagesCount; i++)
{
 FREngine.IFRPage page = frDoc.Pages[i];
 FREngine.ITextOrientation ori = page.DetectOrientation(null, null);
 rotations[i] = FREngine.RotationTypeEnum.RT_UnknownRotation;
 if( ori != null ) {
  rotations[i] = ori.RotationType;
 }
}

See also

FRPage IPagePreprocessingParams::CorrectOrientationMode Working with Profiles