#include "ltimgkrn.h"
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.
Value | Meaning |
---|---|
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.
L_INT KrnDetectDocumentExample(L_VOID)
{
L_INT ret;
BITMAPHANDLE bitmap; /* Bitmap handle to hold the loaded image. */
L_POINT documentArea[4]; /* 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)
return ret;
/* 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);
else
MessageBox(NULL, TEXT("No document detected"), TEXT("L_ImgKrnDetectDocument"), MB_OK);
L_FreeBitmap(&bitmap);
return ret;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document