imnoise | R Documentation |
This function adds noise to an input image.
imnoise(img, type = "gaussian", mean = 0, sd = 0.01, epsilon = 0.05, var = 0.04,
looks = 1)
img |
input grayscale image matrix. |
type |
character string, specifying the type of contamination: |
mean |
mean for the Gaussian noise, default value is |
sd |
standard deviation for the Gaussian noise, default value is |
epsilon |
contamination percentage for the salt and pepper noise with default noise
density |
var |
variance of uniform multiplicative noise using the equation |
looks |
parameter of gamma multiplicative noise. The default value is |
Noisy image, returned as a numeric matrix. The imnoise
function clips output
pixel values to the range [0,1]
after adding noise.
data(texmos2)
x <- imnoise(texmos2, type = "saltnpepper", epsilon = 0.10)
plot(as.raster(x))
y <- imnoise(texmos2, type = "speckle")
plot(as.raster(y))
z <- imnoise(texmos2, type = "gamma", looks = 4)
plot(as.raster(z))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.