Filters' collection to apply to an image in sequence.

The class represents collection of filters, which need to be applied to an image in sequence. Using the class user may specify set of filters, which will be applied to source image one by one in the order user defines them.

The class itself does not define which pixel formats are accepted for the source image and which pixel formats may be produced by the filter. Format of acceptable source and possible output is defined by filters, which added to the sequence.

Sample usage:

// create filter, which is binarization sequence FiltersSequence filter = new FiltersSequence( new GrayscaleBT709( ), new Threshold( ) ); // apply the filter Bitmap newImage = filter.Apply( image );
Inheritance: System.Collections.CollectionBase, IFilter
Example #1
0
        public Bitmap GetFilteredBitmap(int iterations = 0)
        {
            if (Filters.Count == 0)
            {
                return(Bitmap);
            }
            else
            {
                Filter.ImageTypes imageType = Filter.ImageTypes.ARgb32bpp;

                Af.FiltersSequence sequence = new Af.FiltersSequence();
                foreach (Filter filter in Filters)
                {
                    sequence.Add(filter.FilterObject);
                    if (filter.ImageType < imageType)
                    {
                        imageType = filter.ImageType;
                    }
                }

                if (iterations > 0)
                {
                    return(new Af.FilterIterator(sequence, iterations).Apply(this.bitmap.ToAccordBitmap(imageType)));
                }
                else
                {
                    return(sequence.Apply(this.Bitmap.ToAccordBitmap(imageType)));
                }
            }
        }