FilterIterator - perform specified count of filter's iterations
Inheritance: IFilter
Beispiel #1
0
        public Bitmap Adelgazar()
        {
            Invert ivert = new Invert();
            imagen = ivert.Apply(imagen);

            FiltersSequence filterSequence = new FiltersSequence();

            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));

            FilterIterator filterIterator = new FilterIterator(filterSequence, 15);

            imagen = filterIterator.Apply(imagen);

            imagen = ivert.Apply(imagen);

            return imagen;
        }