ImageEn, unit imageenproc |
|
TImageEnProc.RemoveIsolatedPixels
Declaration
procedure RemoveIsolatedPixels(NoiseColor: Integer = 1; PixelsCount: Integer = 2; CheckDiagonals: Boolean = True);
Description
Removes all groups of isolated pixels within a black and white image (NoiseColor = 0 or 1), or full color image (NoiseColor = -1).
Parameter | Description |
NoiseColor | Specifies the "text" color, 0 is black and 1 is white (for example if you have a document where the text is black NoiseColor must be 0, otherwise it must be 1). For a full color image, specify -1 |
PixelsCount | Specifies the maximum size of isolated pixel block size to remove (e.g. 1 for single pixels, 2 for a pair of isolated pixels, etc.) |
CheckDiagonals | If true, diagonal pixels as treated as connected (i.e. pixels that touch diagonally will not be considered isolated) |
Note: Big PixelCount values may slow down process and cause out-of-memory exceptions
| Demos\ImageEditing\EveryMethod\EveryMethod.dpr |
// Remove single isolated white pixels
ImageEnView1.Proc.RemoveIsolatedPixels( 1, 1 );

// Remove pixel blocks of less than 16 pixels (e.g. 4x4) from a color image
ImageEnView1.Proc.RemoveIsolatedPixels( -1, 16 );

// Removes isolated groups of black pixels up to 16 pixels (e.g. 4x4)
ImageEnView1.Proc.RemoveIsolatedPixels( 0, 16 );

// Removes isolated groups of black pixels up to 20 pixels (e.g. 4x5)
ImageEnView1.Proc.RemoveIsolatedPixels( 0, 20 );

// Removes isolated groups of white and black pixels up to 20 pixels (e.g. 4x5)
ImageEnView1.Proc.RemoveIsolatedPixels( 0, 20 );
ImageEnView1.Proc.RemoveIsolatedPixels( 1, 20 );
