Click or drag to resize
Accord.NET (logo)

FilterIterator Class

Filter iterator.
Inheritance Hierarchy
SystemObject
  Accord.Imaging.FiltersFilterIterator

Namespace:  Accord.Imaging.Filters
Assembly:  Accord.Imaging (in Accord.Imaging.dll) Version: 3.6.0
Syntax
public class FilterIterator : IFilter, 
	IFilterInformation
Request Example View Source

The FilterIterator type exposes the following members.

Constructors
  NameDescription
Public methodFilterIterator(IFilter)
Initializes a new instance of the FilterIterator class.
Public methodFilterIterator(IFilter, Int32)
Initializes a new instance of the FilterIterator class.
Top
Properties
  NameDescription
Public propertyBaseFilter
Base filter.
Public propertyFormatTranslations
Format translations dictionary.
Public propertyIterations
Iterations amount, [1, 255].
Top
Methods
  NameDescription
Public methodApply(Bitmap)
Apply filter to an image.
Public methodApply(BitmapData)
Apply filter to an image.
Public methodApply(UnmanagedImage)
Apply filter to an image in unmanaged memory.
Public methodApply(UnmanagedImage, UnmanagedImage)
Apply filter to an image in unmanaged memory.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodToT
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
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 Note
The filter itself does not have any restrictions to pixel format of source image. This is set by base filter.

Note 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):

// 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:

See Also