Filter iterator.
Namespace:
AForge.Imaging.FiltersAssembly: AForge.Imaging (in AForge.Imaging.dll) Version: 2.2.3.0 (2.2.3.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.
Sample usage (morphological thinning):
// 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: