The goal of imgnoise is to provide mathematicians and researchers with a convenient method for generating noise in images and other signals stored as arrays in R.
Currently, the four types of noise supported are Gaussian, Salt and Pepper, Speckle, and Uniform Noise.
You can install imgnoise from github with:
# install.packages("devtools")
devtools::install_github("rayheberer/imgnoise")
This is a basic example which shows you how to implement gaussian noise.
## Loading an image
library(png)
logo = readPNG(system.file("img", "Rlogo.png", package="png"))
## Applying Noise
imgnoise(logo, "salt_and_pepper", noise_density = 0.1)
LogoSaltPepperNoiseDensityPoint1.png is the result.
For reference, the un-noised image:
imgnoise(logo, "gaussian")
imgnoise(logo, "gaussian", variance = 0.5)
imgnoise(logo, "salt_and_pepper")
imgnoise(logo, "speckle")
imgnoise(logo, "speckle", variance = 0.08)
imgnoise(logo, "uniform")
imgnoise(logo, "uniform", lower_bound = -0.5, upper_bound = 0.5)