C# Class Accord.Imaging.Filters.FilterIterator

Filter iterator.

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.

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

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:

Inheritance: IFilter, IFilterInformation
Show file Open project: accord-net/framework

Public Methods

Method Description
Apply ( Bitmap image ) : Bitmap

Apply filter to an image.

The method keeps the source image unchanged and returns the result of image processing filter as new image.

Apply ( BitmapData imageData ) : Bitmap

Apply filter to an image.

The filter accepts bitmap data as input and returns the result of image processing filter as new image. The source image data are kept unchanged.

Apply ( UnmanagedImage image ) : UnmanagedImage

Apply filter to an image in unmanaged memory.

The method keeps the source image unchanged and returns the result of image processing filter as new image.

Apply ( UnmanagedImage sourceImage, UnmanagedImage destinationImage ) : void

Apply filter to an image in unmanaged memory.

The method keeps the source image unchanged and puts result of image processing into destination image.

The destination image must have the same width and height as source image. Also destination image must have pixel format, which is expected by particular filter (see FormatTranslations property for information about pixel format conversions).

FilterIterator ( IFilter baseFilter ) : System

Initializes a new instance of the FilterIterator class.

FilterIterator ( IFilter baseFilter, int iterations ) : System

Initializes a new instance of the FilterIterator class.

Method Details

Apply() public method

Apply filter to an image.
The method keeps the source image unchanged and returns the result of image processing filter as new image.
public Apply ( Bitmap image ) : Bitmap
image System.Drawing.Bitmap Source image to apply filter to.
return System.Drawing.Bitmap

Apply() public method

Apply filter to an image.
The filter accepts bitmap data as input and returns the result of image processing filter as new image. The source image data are kept unchanged.
public Apply ( BitmapData imageData ) : Bitmap
imageData System.Drawing.Imaging.BitmapData Source image to apply filter to.
return System.Drawing.Bitmap

Apply() public method

Apply filter to an image in unmanaged memory.
The method keeps the source image unchanged and returns the result of image processing filter as new image.
public Apply ( UnmanagedImage image ) : UnmanagedImage
image UnmanagedImage Source image in unmanaged memory to apply filter to.
return UnmanagedImage

Apply() public method

Apply filter to an image in unmanaged memory.

The method keeps the source image unchanged and puts result of image processing into destination image.

The destination image must have the same width and height as source image. Also destination image must have pixel format, which is expected by particular filter (see FormatTranslations property for information about pixel format conversions).

public Apply ( UnmanagedImage sourceImage, UnmanagedImage destinationImage ) : void
sourceImage UnmanagedImage Source image in unmanaged memory to apply filter to.
destinationImage UnmanagedImage Destination image in unmanaged memory to put result into.
return void

FilterIterator() public method

Initializes a new instance of the FilterIterator class.
public FilterIterator ( IFilter baseFilter ) : System
baseFilter IFilter Filter to iterate.
return System

FilterIterator() public method

Initializes a new instance of the FilterIterator class.
public FilterIterator ( IFilter baseFilter, int iterations ) : System
baseFilter IFilter Filter to iterate.
iterations int Iterations amount.
return System