L_ImgKrnDetectDocument

#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.

Parameters

BITMAPHANDLE *bitmap

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

L_POINT *documentArea

An array of L_POINT that contains the points that represent the edges of the document that have been detected.

Returns

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

Comments

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

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

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 Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help