L_INT LBitmap::DeskewExt(pnAngle, uAngleRange, uAngleResolution, crBack, uFlags)
Rotates the specified bitmap to straighten it. This function typically is used to automatically straighten scanned images.
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.
Maximum angle of deskew, in hundredths of degrees. Possible values range from -4500 to 4500. This value is divided internally by 100.
Deskew angle precision. The valid range is from 1 to uAngleRange (maximum deskew angle). The real value is divided by 10.
Color used to fill the background following rotation. This value is used only if DSK_FILL is set in uFlags.
Flags that indicate whether or not to deskew the image, which background color to use, whether to deskew the image if the skew angle is very small, which type of interpolation is to be used, and whether the image is mostly text or text and pictures. You can use a bitwise OR ( | ) to specify one flag from each group.
|DSKW_PROCESS||[0x00000000] Deskew (rotate) the image.|
|DSKW_NOPROCESS||[0x00000001] Do not deskew (rotate) the image. Use this flag to find the angle of rotation.|
|DSKW_FILL||[0x00000000] Use the color in crBack to fill areas exposed after rotation.|
|DSKW_NOFILL||[0x00000010] Let the function automatically find the suitable background color to fill areas exposed after rotation. Ignore the crBack parameter.|
|DSKW_NOTHRESHOLD||[0x00000000] Deskew (rotate) the image for any deskew angle value.|
|DSKW_THRESHOLD||[0x00000100] Do not deskew the image if the deskew angle is very small (less than 0.5 degrees).|
|DSKW_LINEAR||[0x00000000] Do not perform interpolation when rotating.|
|DSKW_RESAMPLE||[0x00001000] Perform bilinear interpolation when rotating.|
|DSKW_BICUBIC||[0x00002000] Perform bicubic interpolation when rotating.|
|DSKW_DOCUMENTIMAGE||[0x00000000] The image contains only text.|
|DSKW_DOCUMENTANDPICTURE||[0x00010000] The image contains text and pictures.|
|DSKW_NORMALSPEEDROTATE||[0x00000000] Rotate at normal speed (high quality). This is the default value.|
|DSKW_HIGHSPEEDROTATE||[0x00100000] Rotate at high speed (moderate quality, only for 1-bit images)|
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
Like LBitmap::Deskew, you can use this function to automatically straighten scanned documents. With this function, deskewing has been extended to increase the possible deskew angle (from 20 degrees to 45 degrees in either direction). In addition it adds the capability to forgo deskewing if the deskew angle is very small and to specify the resolution of the rotation step, and adds the capability to specify the type of interpolation to be performed while rotating.
If uFlags contains DSKW_NOPROCESS, the function will update pnAngle with the deskew angle without rotating the image.
Bitmaps can be rotated by as much as 45 degrees in either direction to remove the skew. 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 supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.
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.
This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.
nRet = LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), 0, ORDER_BGR);
nRet = LeadBitmap.DeskewExt(NULL, 1000, 2, 0, DSKW_PROCESS | DSKW_NOFILL| DSKW_LINEAR| DSKW_DOCUMENTIMAGE);
nRet = LeadBitmap.Save (MAKE_IMAGE_PATH(TEXT("Result.BMP")), FILE_BMP, 24, 0, NULL);
pBITMAPHANDLE pBitmapHandle = LeadBitmap.GetHandle();
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries