public Bitmap ToSaltAndPepperNoise(Bitmap Im) { AForge.Imaging.Filters.SaltAndPepperNoise Img = new SaltAndPepperNoise(); Bitmap bmImage = AForge.Imaging.Image.Clone(new Bitmap(Im), PixelFormat.Format24bppRgb); return(Img.Apply(bmImage)); }
//default noiseAmount=10 public static Bitmap SaltAndPepper(Bitmap sourceImage, double noiseAmount) { var filter = new SaltAndPepperNoise(noiseAmount); return(filter.Apply(sourceImage)); }