imgnoise: Takes an numeric array of any number of dimensions, and...

Description Usage Arguments Examples

View source: R/imgnoise.R

Description

Takes an numeric array of any number of dimensions, and applies a form of random noise to it.

Usage

1
imgnoise(image, noise_type, ...)

Arguments

image

An array of numerics. If generating Salt and Pepper noise, all entries need to be between 0 and 1.

noise_type

The type of noise to apply to the array - Gaussian, Salt and Pepper, Speckle, or Uniform noise.

mu

If generating Gaussian noise - the mean of the normal distribution the random number is sampled from.

variance

If generating Gaussian or Speckle noise - the variance of the distribution the random number is sampled from.

noise_density

If generating Salt and Pepper noise - the approximate proportion (between 0 and 1) of entries in the array that will be changed to 0 or 1.

lower_bound

If generating Uniform noise - the minimum possible value for the random number.

upper_bound

If generating Uniform noise - the maximum possible value for the random number.

Examples

1
2
3
4
5
6
7
#suppose Rlogo is an array generated by Rlogo = readPNG(system.file("img", "Rlogo.png", package = "png))
imgnoise(Rlogo, "gaussian", mu = 0.2, variance = 0.3)
imgnoise(Rlogo, "salt_and_pepper", noise_density = 0.8)
imgnoise(Rlogo, "speckle", variance = 0.15)
imgnoise(Rlogo, "uniform", lower_bound = -0.4, upper_bound = 0.9)
imgnoise(Rlogo, "gaussian")
imgnoise(Rlogo, "salt_and_pepper")

rayheberer/imgnoise documentation built on Dec. 5, 2017, 1:34 a.m.