How can we apply a gaussian noise to a image?

65 visualizaciones (últimos 30 días)
Vishnu R
Vishnu R el 27 de Feb. de 2016
Editada: John BG el 27 de Feb. de 2016
I want to apply gaussian noise to my input image? Is it possible to enhance the gaussian noise added image?

Respuestas (1)

John BG
John BG el 27 de Feb. de 2016
Editada: John BG el 27 de Feb. de 2016
Vishnu
Gaussian and Normal distributions are the same.
array_gaussian_noise=mu+randn(size_1,size_2)*sigma
where mu is the mean value, when generating noise this is usually 0.
[size_1 size_2] is the size of the image
sigma is the standard deviation
Bear in mind that unlike randi, where you know the range of the uniformly distributed random outcome, with gaussian, as small as the noise may be, some noise may spike out of specs or even show negative. To match the noise to the uint8 type of RGB images, constrain the above with for instance:
array_gaussian_noise=mu+uint8(floor(randn(size_1,size_2)*sigma))
or
array_gaussian_noise=mu+uint8(abs(floor(randn(size_1,size_2)*sigma)))
The first one would simply remove all negative noise, the second one, brings to positive all negative noise values.
You really have to generate 3 of these arrays, 3 different noise matrices, to add each to RGB image components respectively.
Play with sigma and mu, on each image RGB layer to do whatever you mean by 'enhance' the added noise.
If you have the Image Processing Toolbox, it's straight forward with command imnoise, for instance:
A=imread('imagefile.jpg')
sig=100; V=(sig/256)^2 %
A_added_noise=imnoise(A,'gaussian',0,V)
If you find this answer of any help solving this question, please click on the thumbs-up vote link,
thanks in advance
John

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by