L_ImgKrnDetectDocument

#include "ltimgkrn.h"

L_LTIMGKRN_API L_INT L_ImgKrnDetectDocument(bitmap, documentArea)

BITMAPHANDLE *bitmap; pointer to the bitmap handle
L_POINT *documentArea; document edges points

Detects and obtains the document edges points in an image.

Parameter Description
bitmap Pointer to the bitmap handle referencing the bitmap to be processed.
documentArea An array of L_POINT that contains the points that represent the edges of the document that have been detected.

Returns

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.

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.

Required DLLs and Libraries

LTIMGKRN
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, Linux.

See Also
Functions: L_ImgKrnCopyImage, L_ImgKrnCreateImage, L_ImgKrnCropImage, L_ImgKrnDetectGlare, L_ImgKrnFromYUV, L_ImgKrnInvertImage, L_ImgKrnManualPerspectiveCorrection, L_ImgKrnRotateFlipImage, L_ImgKrnSignalToNoiseRatio
Topics:

Raster Image Functions: Image Analysis

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.2018.1.19
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help