LEADTOOLS OCR C DLL Help > Function References > OCR Professional > L_Doc2DetectOrientationDegree |
#include "ltdoc2.h"
L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2DetectOrientationDegree(hDoc, nPageIndex, pnRotate)
L_HDOC2 hDoc; |
/* handle to the OCR document.*/ |
L_INT nPageIndex; |
/* page index */ |
L_INT * pnRotate; |
/* pointer to a variable */ |
Determines the angle by which the specified page needs to be oriented.
Parameter |
Description |
hDoc |
Handle to the OCR document. |
nPageIndex |
Index of the page for which to get the orientation angle. This index is zero-based. |
pnRotate |
Pointer to a variable to be updated with the orientation angle, in degrees. Possible values are: +90, +180, and +270. The rotation is clockwise. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
The purpose of orientation is to make the page more readable during recognition by making sure the top of the page is positioned properly. That is, a page that is oriented correctly like this:
is much more readable than the same page oriented like this:
Please note that this function just provides the angle of orientation that is needed. It does not actually orient the page. To orient the page, call the L_Doc2AutoOrientPage function.
If the specified page does not need to be oriented the pnRotate parameter is updated with 0.
To automatically orient a page, call the L_Doc2AutoOrientPage function.
Required DLLs and Libraries
LTDOC2 For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Example
L_LTDOC2TEX_API L_INT Doc2DetectOrientationDegreeExample(L_HDOC2 hDoc,L_INT nPageIndex) { L_INT nRet; L_INT nRotate = 0; nRet = L_Doc2DetectOrientationDegree(hDoc, nPageIndex, &nRotate); if (nRet == SUCCESS) { L_TCHAR szBuffer[1024]; wsprintf(szBuffer, TEXT("Orientation degree = %d"), nRotate); MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK); } else return nRet; return SUCCESS; }