Filter iterator.

Namespace:  AForge.Imaging.Filters
Assembly:  AForge.Imaging (in AForge.Imaging.dll) Version: 2.2.5.0 (2.2.5.0)

Syntax

C#
public class FilterIterator : IFilter, 
	IFilterInformation

Remarks

Filter iterator performs specified amount of filter's iterations. The filter take the specified base filter and applies it to source image specified amount of times.

Note:The filter itself does not have any restrictions to pixel format of source image. This is set by base filter.

Note:The filter does image processing using only IFilter interface of the specified base filter. This means that this filter may not utilize all potential features of the base filter, like in-place processing (see IInPlaceFilter) and region based processing (see IInPlacePartialFilter). To utilize those features, it is required to do filter's iteration manually.

Sample usage (morphological thinning):

CopyC#
// create filter sequence
FiltersSequence filterSequence = new FiltersSequence( );
// add 8 thinning filters with different structuring elements
filterSequence.Add( new HitAndMiss(
    new short [,] { { 0, 0, 0 }, { -1, 1, -1 }, { 1, 1, 1 } },
    HitAndMiss.Modes.Thinning ) );
filterSequence.Add( new HitAndMiss(
    new short [,] { { -1, 0, 0 }, { 1, 1, 0 }, { -1, 1, -1 } },
    HitAndMiss.Modes.Thinning ) );
filterSequence.Add( new HitAndMiss(
    new short [,] { { 1, -1, 0 }, { 1, 1, 0 }, { 1, -1, 0 } },
    HitAndMiss.Modes.Thinning ) );
filterSequence.Add( new HitAndMiss(
    new short [,] { { -1, 1, -1 }, { 1, 1, 0 }, { -1, 0, 0 } },
    HitAndMiss.Modes.Thinning ) );
filterSequence.Add( new HitAndMiss(
    new short [,] { { 1, 1, 1 }, { -1, 1, -1 }, { 0, 0, 0 } },
    HitAndMiss.Modes.Thinning ) );
filterSequence.Add( new HitAndMiss(
    new short [,] { { -1, 1, -1 }, { 0, 1, 1 }, { 0, 0, -1 } },
    HitAndMiss.Modes.Thinning ) );
filterSequence.Add( new HitAndMiss(
    new short [,] { { 0, -1, 1 }, { 0, 1, 1 }, { 0, -1, 1 } },
    HitAndMiss.Modes.Thinning ) );
filterSequence.Add( new HitAndMiss(
    new short [,] { { 0, 0, -1 }, { 0, 1, 1 }, { -1, 1, -1 } },
    HitAndMiss.Modes.Thinning ) );
// create filter iterator for 10 iterations
FilterIterator filter = new FilterIterator( filterSequence, 10 );
// apply the filter
Bitmap newImage = filter.Apply( image );

Initial image:

Result image:

Inheritance Hierarchy

System..::.Object
  AForge.Imaging.Filters..::.FilterIterator

See Also