﻿ LBitmap::DotRemove | LBitmap Class Members | Raster imaging C++ Class Library Help


#include "ltwrappr.h"

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

Finds and removes dots and specks of various sizes.



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

L_UINT32 uFlags

Reserved for future use. Must be 0.


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


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.


Required DLLs and Libraries


Win32, x64.

See Also




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.pBitmapRegion  = &BitmapRegion; 
   dr.uBitmapStructSize = sizeof(BitmapRegion); 
   nRet = pBitmapWindow->DotRemove(&dr); 
   if (nRet == SUCCESS) 
      //Delete the existing region 
      LBitmapRgn Region(pBitmapWindow); 
      pBitmapWindow->SetHandle(dr.pBitmapRegion, FALSE); 
   return nRet; 

Help Version 21.0.2021.4.8
Products | Support | Contact Us | Intellectual Property Notices
LEADTOOLS Raster Imaging C++ Class Library Help