public mIterate(Bitmap SourceBitmap, mFilters Filter, int Iterations) { ModifiedBitmap = (Bitmap)SourceBitmap.Clone(); ModifiedBitmap = new mSetFormat(ModifiedBitmap, Filter.BitmapType).ModifiedBitmap; FilterIterator Iterator = new FilterIterator(Filter.Sequence, Iterations); ModifiedBitmap = Iterator.Apply(ModifiedBitmap); ModifiedBitmap = new mSetFormat(ModifiedBitmap, Filter.BitmapType).ModifiedBitmap; ModifiedBitmap.SetResolution(SourceBitmap.HorizontalResolution, SourceBitmap.VerticalResolution); }
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); }