L_LTIMGCOR_API L_INT L_Keystone(pBitmap, pPoints, pOutBitmap)
Performs inverse perspective transformation (keystoning) on an image.
Pointer to the bitmap handle to be rectified.
Pointer to an L_POINT that contains the four polygon points on the bitmap that will be mapped to a rectangle.
Pointer of a pointer to the bitmap handle that represents the resulting rectified bitmap.
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
Frequently, images captured by portable devices are distorted because they are projected onto a surface at an angle. Vertical lines become slanted, etc. The L_Keystone function maps a polygon to a rectangle (an inverse perspective transformation), and can be used to correct the perspective of such images.
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
Win32, x64, Linux.
This example loads a bitmap and adjusts its perspective view.
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("Master.jpg")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
/* Apply a Keystone filter */
L_POINT pPoints ;
pPoints.x = 94 ;
pPoints.y = 94 ;
pPoints.x = 306 ;
pPoints.y = 43 ;
pPoints.x = 318 ;
pPoints.y = 237 ;
pPoints.x = 98 ;
pPoints.y = 237 ;
nRet = L_Keystone(&LeadBitmap, pPoints, &OutBitmap);
if (nRet == SUCCESS)
nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &OutBitmap, FILE_BMP, 24, 0, NULL);
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries