GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureImaging Class / RemoveBlob Method / RemoveBlob(Int32,Int32,Int32,Int32,Int32,Int32,Int32) Method
GdPicture image identifier. Only 1 bit per pixel images with black and white palette are supported.
Minimum Width of Blob considered for removal.
Minimum Height of Blob considered for removal.
Maximum Width of Blob considered for removal.
Maximum Height of Blob considered for removal.
Minimum percentage of black pixels within blob compared to blob bounding rectangle. Range [1-99]
Maximum percentage of black pixels within blob compared to blob bounding rectangle. Range [2-100]
Example





In This Topic
RemoveBlob(Int32,Int32,Int32,Int32,Int32,Int32,Int32) Method
In This Topic
Removes blobs and ink blobs with a specified size margin. It is a very powerful tool for despeckling (removing parasites) from images without affecting the content.
Syntax
'Declaration
 
Public Overloads Function RemoveBlob( _
   ByVal ImageID As Integer, _
   ByVal MinBlobWidth As Integer, _
   ByVal MinBlobHeight As Integer, _
   ByVal MaxBlobWidth As Integer, _
   ByVal MaxBlobHeight As Integer, _
   ByVal MinFillPercent As Integer, _
   ByVal MaxFillPercent As Integer _
) As GdPictureStatus
public function RemoveBlob( 
    ImageID: Integer;
    MinBlobWidth: Integer;
    MinBlobHeight: Integer;
    MaxBlobWidth: Integer;
    MaxBlobHeight: Integer;
    MinFillPercent: Integer;
    MaxFillPercent: Integer
): GdPictureStatus; 
public function RemoveBlob( 
   ImageID : int,
   MinBlobWidth : int,
   MinBlobHeight : int,
   MaxBlobWidth : int,
   MaxBlobHeight : int,
   MinFillPercent : int,
   MaxFillPercent : int
) : GdPictureStatus;

Parameters

ImageID
GdPicture image identifier. Only 1 bit per pixel images with black and white palette are supported.
MinBlobWidth
Minimum Width of Blob considered for removal.
MinBlobHeight
Minimum Height of Blob considered for removal.
MaxBlobWidth
Maximum Width of Blob considered for removal.
MaxBlobHeight
Maximum Height of Blob considered for removal.
MinFillPercent
Minimum percentage of black pixels within blob compared to blob bounding rectangle. Range [1-99]
MaxFillPercent
Maximum percentage of black pixels within blob compared to blob bounding rectangle. Range [2-100]

Return Value

A member of the GdPictureStatus enumeration.
Remarks

This method is used in the "Document Clean Up" C# Demo.

To use it as a despeckling method you need to: 1. Know the range of the noise size (which is usually smaller than a character size). 2. Set the MinFillPercent and MaxFillPercent to 1 and 100 respectively. 3. Set MinBlobWidth and MinBlobHeight to 1 and 2 respectively. 4. Set MaxBlobWidth and MaxBlobHeight to a value smaller than the size of a character in your image. The size of the character is highly dependent on the dpi of the image and the content. The higher the dpi, the higher the MaxBlobWidth and MaxBlobHeight should be.

This method requires the Image Documents component to run.

Example
Removing blobs from a tiff and saving as a png.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.tif", false);
 
    int minBlobWidth = 50;
    int minBlobHeight = 50;
    int maxBlobWidth = 1000;
    int maxBlobHeight = 1000;
    int minFillPercent = 90;
    int maxFillPercent = 100;
 
    gdpictureImaging.RemoveBlob(imageID, minBlobWidth, minBlobHeight, maxBlobWidth, maxBlobHeight, minFillPercent, maxFillPercent);
    gdpictureImaging.SaveAsPNG(imageID, "image.png");
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also