AForge.NET

Testimonials
Features
Samples
Tools
Documentation
License
Downloads
Sources
Discussions
Partners
Projects
Members
Donate

AForge.NET Framework
2.2.5 version is available!

Flood Fill filters

AForge.NET framework provides two pointed flood filter for now - filters which flood the pointed area using specified color or mean color of the area.

Below is the list of implemented flood fill algorithms and the result of their application to the below source image.

Source image
Source image

Pointed Color Flood Fill
The filter performs image's area filling (4 directional) starting from the specified point. It fills the area of the pointed color, but also fills other colors, which are similar to the pointed within specified tolerance.

// create filter
PointedColorFloodFill filter = new PointedColorFloodFill( );
// configure the filter
filter.Tolerance = Color.FromArgb( 150, 92, 92 );
filter.FillColor = Color.FromArgb( 255, 255, 255 );
filter.StartingPoint = new Point( 150, 100 );
// apply the filter
filter.ApplyInPlace( image );
Pointed Color Flood Fill filter

Pointed Mean Flood Fill
The filter is very similar to the above one, but it does not require specifying which color to use to fill image's area. Instead of this the filter goes through the area first calculating its mean color and then it fills the area with calculated mean value.

// create filter
PointedMeanFloodFill filter = new PointedMeanFloodFill( );
// configre the filter
filter.Tolerance = Color.FromArgb( 150, 92, 92 );
filter.StartingPoint = new Point( 150, 100 );
// apply the filter
filter.ApplyInPlace( image );
Pointed Mean Flood Fill filter