L_BlankPageDetectorBitmapExt

#include "l_bitmap.h"

L_LTIMGCOR_API L_INT EXT_FUNCTION L_BlankPageDetectorBitmapExt(pBitmap, bIsBlank, pAccuracy, PMargins, uSensitivity, 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

Pointer to a flag to be updated with a value indicating whether the image is a blank page. Possible values are:

Value Meaning
true Blank page
false Non-blank page

L_UINT * pAccuracy

Pointer to a variable to be updated with the accuracy of the result, in hundredths of a percent. Possible values range from 0 to 10000. This value is divided internally by 100.

pPAGEMARGINS PMargins

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

L_UINT uSensitivity

Determines the sensitivity of the blank page detection, based on the amount of black pixels in the image. Possible values range from 0 to 100.

L_UINT uFlags

Flags that indicate how to define blank pages and determine the function's behavior. Values can be combined when appropriate by using a bitwise OR (|). Use a flag only if it describes the needed behavior. In many cases the default behavior is fine, and no flag is needed.

Note: Some uFlags values are being deprecated in Version 20. They will be removed from the toolkits, effective with LEADTOOLS version 21.

Indicates whether a blank page can have noise. A page is noisy if the height of the noisy object in the image is greater than 10 pixels, although this can be changed. Possible values are:

Default Behavior Override Value
A blank page cannot have noise. It must be totally blank. Include the BLANK_DETECT_NOISY flag [0x00000001] if a blank page can have some noise.

Indicates whether a blank page can have bleed-through from its other side. Possible values are:

Default Behavior Override Value
A blank page cannot have bleed-through from the other side of the page. Include the BLANK_BLEED_THROUGH flag [0x00000010] if a blank page can have bleed-through.

Indicates whether a blank page can have lines. Possible values are:

Default Behavior Override Value
A blank page cannot have any lines. Include the BLANK_DETECT_LINES flag [0x00000100] if a blank page can have lines.

Indicates whether to include blank spaces around the page's edges. Possible values are:

Default Behavior Override Value
A blank page includes the blank spaces around the page's edges. Include the BLANK_USE_ACTIVE_AREA flag [0x00001000] to ignore any blank spaces around the page's edges.

Indicates whether to use the default or user-specified margins. Possible values are:

Default Behavior Override Value
Use the default margins, which are computed automatically by the engine by excluding 6.5% from the image width and 11% from the image height. Include the BLANK_USER_MARGIN flag [0x00010000] to use the user-specified margins, which are specified in PMargins.

Indicates which unit of measure to use. Possible values are:

Default Behavior Override Value
Use the pixel as the unit of measure to specify user margins. Include the BLANK_USE_INCHES flag [0x00400000] to specify that the inch be used as the unit of measure to specify user margins.
Include the BLANK_USE_CENTIMETERS flag [0x00800000] to specify that the centimeter be used as the unit of measure to specify user margins.

Indicates whether to use text analysis. Possible values are:

Default Behavior Override Value
BLANK_ADVANCED [0x00100000] Analyze both text and non-text content.
BLANK_DETECT_TEXT_ONLY [0x00100000] Analyze text and ignore non-text content in the image. The BLANK_ADVANCED flag must be set in order for this flag to be used.
BLANK_USE_PIXELS [0x00000000] Use the Pixel as the unit of measure to specify user-margins.
BLANK_USE_INCHES [0x00400000] Use the Inch as the unit of measure to specify user-margins.
BLANK_USE_CENTIMETERS [0x00800000] Use the Centimeter as the unit of measure to specify user-margins.

Returns

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

Comments

For various reasons, documents being scanned can contain a significant number of blank pages. Disk storage space for the scanned items can be reduced if such pages can be removed before the documents are stored.

This function determines whether the scanned image is a blank page. It can detect noisy, bleed-through, and lined blank pages with high precision and speed, and provides an accuracy percentage for the result.

Support for this function is available in the Document and Medical Imaging toolkits.

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

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

This function does not support 12-, 16-, 48-, or 64-bit images. It returns the ERROR_INV_PARAMETER error code if such an image is passed to this function.

Deprecated uFlags Members

The following flags are being deprecated in Version 20. They will be removed from the toolkits, effective with LEADTOOLS version 21.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

L_INT BlankPageDetectorBitmapExtExample(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; 
   L_UINT Sensitivity = 80; 
 
   nRet = L_BlankPageDetectorBitmapExt(&LeadBitmap, 
      &IsBlank, 
      &Accuracy, 
      NULL, 
      Sensitivity, 
      BLANK_DETECT_NOISY | BLANK_BLEED_THROUGH); 
 
   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