L_LTIMGKRN_API L_INT L_ImgKrnDetectDocument(bitmap, documentArea)
Detects and obtains the points that represent the document edges in an image.
Pointer to the bitmap handle referencing the bitmap to be processed.
An array of L_POINT that contains the points that represent the edges of the document that have been detected.
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
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 results from L_DetectDocument as the input points for the L_ImgKrnPerspectiveCorrectionData structure, which is used by the L_ImgKrnManualPerspectiveCorrection function to correct the perspective of a captured image.
This function can be used if there is depth (z-axis) deformation as well as deformation along the x- and y- axes.
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 Imaging toolkits.
This function supports unsigned data images, but not signed ones.
This function does not support 32-bit grayscale images.
Note: All functions with the L_ImgKrn prefix modify the underlying properties of the input BITMAPHANDLE, including but not limited to:
To avoid BITMAPHANDLE property fidelity loss, pass a copy of your BITMAPHANDLE to all L_ImgKrn* functions.
Required DLLs and Libraries
Win32, x64, Linux.
The following example loads a bitmap, and applies the 3D-perspective effect.
BITMAPHANDLE bitmap; /* Bitmap handle to hold the loaded image. */
L_POINT documentArea; /* Document area region points*/
/* Load the bitmap */
ret = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("PerspectiveDeskew.jpg")), &bitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if (ret != SUCCESS)
/* Apply L_ImgKrnDetectDocument and detect document region */
ret = L_ImgKrnDetectDocument(&bitmap, documentArea);
// Check if document detected
if (ret == SUCCESS)
MessageBox(NULL, TEXT("Document detected"), TEXT("L_ImgKrnDetectDocument"), MB_OK);
MessageBox(NULL, TEXT("No document detected"), TEXT("L_ImgKrnDetectDocument"), MB_OK);
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries