L_BlankPageDetectorBitmap

#include "l_bitmap.h"

L_LTIMGCOR_API L_INT EXT_FUNCTION L_BlankPageDetectorBitmap(pBitmap, bIsBlank, pAccuracy, pMargins, uFlags)

Determines whether the scanned image is a blank page.

Parameters

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle that references the image to be tested.

L_BOOL * bIsBlank

Address of the variable to be updated with image status indicating whether it is a blank page or not. Possible values are:

Value Meaning
True Blank page.
False Non-blank page.

L_UINT * pAccuracy

Address of the variable to be updated with the accuracy percentage of the result. Possible values range from 0 to 10000. This value is divided internally by the value 100.

pPAGEMARGINS pMargins

Pointer to the PAGEMARGINS structure that contains information about excluded margins. Pass NULL as no margins to exclude.

L_UINT uFlags

Flags that indicate how to consider blank pages and the function behavior. You can combine values when appropriate by using a bitwise OR ( | ). Possible values are:

Value Meaning
Consider noisy page as a blank page:
BLANK_DETECT_EMPTY [0x00000000] A page must be totally blank.
BLANK_DETECT_NOISY [0x00000001] A page may have some noise. This is the default value.
Consider page which bleeds through its other side as a blank page:
BLANK_NOT_BLEED_THROUGH [0x00000000] Don't ignore bleed through from the page.
BLANK_BLEED_THROUGH [0x00000010] Ignore bleed through from the page. This is the default value.
Consider lined page as a blank page:
BLANK_DONT_DETECT_LINES [0x00000000] Don't consider lined page as a blank page. This is the default value.
BLANK_DETECT_LINES [0x00000100] Consider lined page as a blank page.
Ignoring blank spaces around the page edges:
BLANK_DONT_USE_ACTIVE_AREA [0x00000000] Don't ignore blank spaces around the page edges. This is the default value.
BLANK_USE_ACTIVE_AREA [0x00001000] Ignore blank spaces around the page edges.
Use default margins or user-specified margins:
BLANK_DEFAULT_MARGIN [0x00000000] Use default margins, which are computed automatically by the function based on the page dimensions. This is the default value.
BLANK_USER_MARGIN [0x00010000] Use the user-specified margins, which are specified in pMargins.

Returns

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

Comments

Scanned images can contain blank (empty) pages. This function determines whether the scanned image is a blank page or not, detects noisy, bleed through, and lined blank pages with high precision and speed, and provides a percentage accuracy of the result. This function helps reduce the disk storage space required for scanned images.

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

L_INT BlankPageDetectorBitmapExample(L_VOID) 
{ 
   L_INT nRet; 
   BITMAPHANDLE LeadBitmap;   /* Bitmap handle hold the loaded image. */ 
   /* Load the bitmap, keeping the bits per pixel of the file */ 
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   /* Check if the image is a blank page the bitmap */ 
   L_BOOL IsBlank = 1;  
   L_UINT Accuracy = 0;  
 
   nRet = L_BlankPageDetectorBitmap (&LeadBitmap, 
      &IsBlank, 
      &Accuracy, 
      NULL, 
      BLANK_DETECT_NOISY|BLANK_BLEED_THROUGH|BLANK_DEFAULT_MARGIN); 
 
   if(IsBlank) 
      OutputDebugString(L_TEXT("Image is blank.\n")); 
   else 
      OutputDebugString(L_TEXT("Image is not blank.\n")); 
 
   //free bitmap 
   L_FreeBitmap(&LeadBitmap); 
 
   return nRet; 
} 
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