LBitmap::Deskew
#include "ltwrappr.h"
virtual L_INT LBitmap::Deskew(pnAngle=NULL, crFill, uFlags)
/* address of the variable to be updated */ | |
COLORREF crFill; |
/* fill color */ |
L_UINT uFlags; |
/* flags*/ |
Rotates the specified bitmap to straighten it. This function typically is used to automatically straighten scanned images. This function is available in Document/Medical toolkits only.
Parameter |
Description |
|
pnAngle |
NULL or the address of the variable to be updated with the amount that the function rotates the image. The amount of rotation is expressed in hundredths of degrees. For example, 500 means 5 degrees clockwise. You can pass NULL if you do not need to check the amount of rotation. |
|
crFill |
Color used to fill the background following rotation. This is used only if DSK_FILL is set in uFlags. |
|
uFlags |
Flags that indicate whether or not to deskew the image and what background color to use. You can use a bitwise OR (|) to specify one flag from each group. |
|
|
The following flags indicate whether to deskew the image after the function finds the skew angle: |
|
|
Value |
Meaning |
|
DSKW_PROCESS |
[0x00000000] Deskew (rotate) the image. |
|
DSKW_NOPROCESS |
[0x00000001] Don’t deskew (rotate) the image. Generally this flag is used to find the angle of rotation. |
|
The following flags indicate what background color to use: |
|
|
Value |
Meaning |
|
DSKW_FILL |
[0x00000000] Use the color in crFill to fill areas exposed after rotation. |
|
DSKW_NOFILL |
[0x00000010] Let the function automatically find the suitable background color used to fill areas exposed after rotation. crFill is ignored in this case. |
|
The following flags indicate image type: |
|
|
Value |
Meaning |
|
DSKW_DOCUMENTIMAGE |
[0x00000000] The image contains text only. |
|
DSKW_DOCUMENTANDPICTURE |
[0x00010000] The image contains text and pictures or light text. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
If the flags use DSKW_NOPROCESS, the function will return the deskew angle in the pnAngle variable, without image rotation .
The calculated rotation is limited to 10 degrees in either direction. This function is intended for images, such as scanned documents, that are mainly horizontal lines of text. The results are less predictable with other types of images.
To update a status bar or detect a user interrupt during execution of this function, refer to LBase::EnableStatusCallback.
This function does not support 12 and 16-bit grayscale and 48 and 64-bit color images. If the image is 12 and 16-bit grayscale and 48 and 64-bit color, the function will not return an error.
This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.
Required DLLs and Libraries
LTDIS 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
Functions: |
|
Topics: |
|
|
|
|
|
|
|
|
Example
LBitmap LeadBitmap;
L_INT32 lRotatedAngle;
L_TCHAR szDummyBuffer[50];
LeadBitmap.Load(TEXT("image1.cmp"), 0,ORDER_BGR);
// Deskew the image, and get the angle with which the image was rotated
LeadBitmap.Deskew(&lRotatedAngle, RGB(0,0,0), DSKW_PROCESS | DSKW_NOFILL| DSKW_DOCUMENTIMAGE);
wsprintf(szDummyBuffer, TEXT("The image was rotated with %d degrees"), lRotatedAngle/100);
MessageBox(0, szDummyBuffer, TEXT("Deskew"), MB_OK);