ImageEn, unit imageenproc

TImageEnProc.RemoveIsolatedPixels

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.

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)
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:
Only works with black & white images (1bit).
Big PixelCount values may slow down process and cause out of memory exceptions


Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Example

// removes single isolated pixels (black pixels)
ImageEnView1.Proc.RemoveIsolatedPixels(0, 1);

// removes groups of two isolated pixels (black pixels)
ImageEnView1.Proc.RemoveIsolatedPixels(0, 2);