L_PerspectiveDeskewExt

Summary

Detects and automatically deskews a 3D document image, with specifying the detection options.

Syntax

#include "Ltimgcor.h"

L_LTIMGCOR_API L_INT L_PerspectiveDeskewExt(pBitmap, pOptions, uFlags)

Parameters

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle referencing the bitmap to be deskewed.

pPERSPECTIVEDESKEWOPTIONS pOptions

Pointer to a structure specifying the options for the detection.

L_UINT uFlags

Reserved for future used. Pass 0.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function can change the specified image. To keep the original image unchanged, use this function on a copy.

For the best results, the document's boundaries should be inside the captured view and have a different background color than the background of the captured view.

Use the L_PerspectiveDeskewExt function if there is depth (z-axis) deformation as well as deformation along the x- and y- axes. Use the L_DeskewBitmap function to fix 2D orientation.

Unlike the L_DeskewBitmap function, the L_PerspectiveDeskewExt does not look at the content of the captured document.

If the L_PerspectiveDeskewExt fails to correct the skew, the original image is not changed.

To detect and deskew the 3D document image without specifying the detection options, call L_PerspectiveDeskew.

This function can only process entire images. It does not support regions.

This function supports 24 and 32-bit color images.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example loads a bitmap and applies perspective deskew filter.

L_INT PerspectiveDeskewExtFilterBitmapExample(L_VOID) 
{ 
   L_INT nRet; 
   BITMAPHANDLE LeadBitmap;   /* Bitmap handle to hold the loaded image. */ 
 
   /* Load the bitmap, keeping the bits per pixel of the file */ 
   nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("PerspectiveDeskew.jpg")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   /* Apply a perspective deskew filter*/ 
   PERSPECTIVEDESKEWOPTIONS options = { 0 }; 
   options.uStructSize = sizeof(PERSPECTIVEDESKEWOPTIONS); 
   options.bDonotProcessBitmap = FALSE; 
   nRet = L_PerspectiveDeskewExt(&LeadBitmap, &options, 0); 
   if (nRet != SUCCESS) 
   { 
      //free bitmap 
      if (LeadBitmap.Flags.Allocated) 
         L_FreeBitmap(&LeadBitmap); 
 
      return nRet; 
   } 
 
   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL); 
 
   //free bitmap 
   if (LeadBitmap.Flags.Allocated) 
      L_FreeBitmap(&LeadBitmap); 
 
   return nRet; 
} 

Help Version 22.0.2023.7.11
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.