LBitmap::DotRemove
#include "ltwrappr.h"
virtual L_INT LBitmap::DotRemove(pDotRemove, uFlags = 0)
pDOTREMOVE pDotRemove; |
/* pointer to a structure */ |
L_UINT32 uFlags; |
/* flags */ |
Finds and removes dots and specks of various sizes.
Parameter |
Description |
pDotRemove |
Pointer to the DOTREMOVE structure that LEADTOOLS uses to remove dots. |
uFlags |
Reserved for future use. Must be 0. |
Returns
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.
Required DLLs and Libraries
LTIMGCOR For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
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; }