Adds noise to a matrix. The inputs and outputs will be normalized between 0 and 1.
y = add_noise(x, type)
y = add_noise(x, type, parameters)Legacy name: imnoise
Matrix to add noise to. x can be a real, complex, or integer matrix of any dimension. Possible integer data types are uint8, uint16, or int16. Add_noise first converts integer inputs to double, adds the noise, and then converts the noised signal back to the original data type.
Type of noise to add to x. type is a string that accepts the following values:
Adds Gaussian noise, that is y = x + p, where p is a Gaussian distributed noise. This type takes two parameters. The first parameter specifies the mean of the Gaussian noise. The default value is 0. The second parameter specifies the variance of the Gaussian noise. The default value is 0.01.
|'salt & pepper'||
Adds salt and pepper noise. Specifically, MathScript resets some elements in x to 0 or 1 randomly. This type takes one parameter that specifies the density of elements to reset. The parameter must range from 0 to 1. The default value is 0.05.
Adds speckle noise, that is y = x + x*p, where p is a Gaussian distributed noise of zero mean. This type takes one parameter that specifies the variance of the Gaussian noise. The default is 0.04.
Parameters for the noise.
x with noise.
X = peakfcn2d; figure image(X) Y = add_noise(X, 'gaussian', 0, 0.04); figure image(Y)
Where This Node Can Run:
Desktop OS: Windows
FPGA: This product does not support FPGA devices