LBitmap::Keystone

#include "ltwrappr.h"

virtual L_INT LBitmap::Keystone(pPoints, ppOutBitmap)

L_POINT* pPoints;

four polygon points to be mapped to rectangle

pBITMAPHANDLE* ppOutBitmap;

resultant rectified bitmap

Performs inverse perspective transformation (keystoning) on an image.

Parameter Description
pPoints Pointer to L_POINT that contains four polygon points to be mapped to rectangle.
ppOutBitmap Pointer of pointer to the bitmap handle that represents the resultant rectified bitmap.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Frequently, images captured by portable devices are distorted because they are projected onto a surface at an angle. Vertical lines become slanted, etc. This function maps a polygon to a rectangle (an inverse perspective transformation), and can be used to correct the perspective of such images.

The input pPoints should contain 4 polygon points. These points will become the corners of the rectangle and the rest of the pixels are shifted accordingly.

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

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images.

Required DLLs and Libraries

LTDIS
LTFIL
LTIMGCOR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

LBitmap::AlignImages, LBitmap::ManualPerspectiveDeskew, LBitmap::PerspectiveDeskew, Class Members

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
#if defined (LEADTOOLS_V19_OR_LATER) 
L_INT LBitmap__KeystoneExample(L_VOID) 
{ 
   L_INT nRet ; 
   LBitmap LeadBitmap ; 
   nRet = LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("Master.jpg")), 0,ORDER_BGR) ; 
   if(nRet !=SUCCESS) 
      return nRet ; 
   /* Apply a Keystone filter */ 
   pBITMAPHANDLE pOutBitmap = NULL ; 
   L_POINT pPoints[4] ; 
   pPoints[0].x =  94 ; 
   pPoints[0].y =  94 ; 
   pPoints[1].x = 306 ; 
   pPoints[1].y =  43 ; 
   pPoints[2].x = 318 ; 
   pPoints[2].y = 237 ; 
   pPoints[3].x =  98 ; 
   pPoints[3].y = 237 ; 
   nRet = LeadBitmap.Keystone(pPoints, &pOutBitmap); 
   if(pOutBitmap->Flags.Allocated) 
      L_FreeBitmap(pOutBitmap); 
   return nRet; 
} 
#endif // LEADTOOLS_V19_OR_LATER 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help