Salt and pepper noise.

The filter adds random salt and pepper noise - sets maximum or minimum values to randomly selected pixels.

The filter accepts 8 bpp grayscale images and 24/32 bpp color images for processing.

Sample usage:

// create filter SaltAndPepperNoise filter = new SaltAndPepperNoise( 10 ); // apply the filter filter.ApplyInPlace( image );

Initial image:

Result image:

상속: BaseInPlacePartialFilter
예제 #1
0
 public static void SaltAndPepperNoise(this Bitmap image, double noiseAmount)
 {
     AForge.Imaging.Filters.SaltAndPepperNoise s = new AForge.Imaging.Filters.SaltAndPepperNoise();
     s.NoiseAmount = noiseAmount;
     s.ApplyInPlace(image);
 }
예제 #2
0
 public static Bitmap SaltAndPepper(Bitmap bmp, int intensity)
 {
     SaltAndPepperNoise filter = new SaltAndPepperNoise(intensity);
     filter.ApplyInPlace(bmp);
     return bmp;
 }
예제 #3
0
 /// <summary>
 /// Performs a salt and pepper attack on the bmp.
 /// </summary>
 /// <param name="p">the intensity to perform the attack at</param>
 /// <returns>the resulting image</returns>
 internal AltariaImage SaltAndPepper(double p)
 {
     AltariaImage nai = new AltariaImage(new Bitmap(this.originalbmp), this.Name);
     SaltAndPepperNoise filter = new SaltAndPepperNoise(p);
     filter.ApplyInPlace(nai.originalbmp);
     return nai;
 }