Finds and removes dots and specks of various sizes.
#include "ltwrappr.h"
virtual L_INT LBitmap::DotRemove(pDotRemove, uFlags = 0)
Pointer to the DOTREMOVE structure that LEADTOOLS uses to remove dots.
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.
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 - After
View additional platform support for this Dot Remove function.
Win32, x64.
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 Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document