LBitmap::DotRemove

Summary

Finds and removes dots and specks of various sizes.

Syntax

#include "ltwrappr.h"

virtual L_INT LBitmap::DotRemove(pDotRemove, uFlags = 0)

Parameters

pDOTREMOVE pDotRemove

Pointer to the DOTREMOVE structure that LEADTOOLS uses to remove dots.

L_UINT32 uFlags

Reserved for future use. Must be 0.

Returns

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

Comments

This function finds and removes dots, specks, and blobs of various sizes in 1-bit documents. The dots, specks, and blobs may or may not be all black.

This function works only on 1-bit black and white images.

If a region is selected, only the selected region will be changed by this function. If no region is selected, the whole image will be processed.

The behavior of this function can be modified by overriding LBitmap::DotRemoveCallback.

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.

Dot Remove Function - Before

Dot Remove Function - Before

Dot Remove Function - After

Dot Remove Function - After

View additional platform support for this Dot Remove function.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This example updates a region with all 1x1 to 3x3 specks that are solid black
If a speck has any white pixels, it is NOT added to the region
The call is configured to update a single LEAD region corresponding to all changes
The image itself is unchanged
The derived class LMyBitmap is used to override the DotRemoveCallBack function
The callback member function is used to display information about each speck that is removed
The callback member function does NOT receive a Windows region

L_INT LBitmap__DotRemoveExample(LBitmapWindow *pBitmapWindow) 
{ 
   L_INT32        nRet; 
   BITMAPHANDLE   BitmapRegion; 
   DOTREMOVE      dr; 
   dr.uStructSize = sizeof(DOTREMOVE); 
 
   memset(&BitmapRegion, 0, sizeof(BITMAPHANDLE)); 
 
   dr.uStructSize    = sizeof(DOTREMOVE); 
 
   dr.uBitmapStructSize = sizeof(BITMAPHANDLE); 
   dr.iMinDotWidth   = 1; 
   dr.iMinDotHeight  = 1; 
   dr.iMaxDotWidth   = 3; 
   dr.iMaxDotHeight  = 3; 
   dr.uFlags         = DOT_USE_SIZE | DOT_SINGLE_REGION | DOT_LEAD_REGION | DOT_IMAGE_UNCHANGED; 
   dr.pBitmapRegion  = &BitmapRegion; 
   dr.uBitmapStructSize = sizeof(BitmapRegion); 
   nRet = pBitmapWindow->DotRemove(&dr); 
 
   if (nRet == SUCCESS) 
   { 
      //Delete the existing region 
      LBitmapRgn Region(pBitmapWindow); 
      if(Region.BitmapHasRgn()) 
      { 
         Region.Free(); 
      } 
 
      pBitmapWindow->SetHandle(dr.pBitmapRegion, FALSE); 
   } 
 
   return nRet; 
} 

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.