Add noise to image using additive Guassian, salt-and-pepper, shot, or speckle noise.

addNoiseToImage(
  image,
  noiseModel = c("additivegaussian", "saltandpepper", "shot", "speckle"),
  noiseParameters
)

Arguments

image

input image

noiseModel

either "additivegaussian", "saltandpepper", "shot", or "speckle".

noiseParameters

vector defining the noise models. additivegaussian: (mean, standardDeviation), saltandpepper: (probability, saltValue, pepperValue), shot: (scale), speckle: (standardDeviation),

Value

noise corrupted image.

Author

NJ Tustison

Examples

image <- antsImageRead(getANTsRData("r16"))
noiseImage <- addNoiseToImage(image, "additivegaussian", c(0, 1))
noiseImage <- addNoiseToImage(image, "saltandpepper", c(0.1, 0, 100))
noiseImage <- addNoiseToImage(image, "shot", c(1.0))
noiseImage <- addNoiseToImage(image, "speckle", c(1.0))