How can we apply a gaussian noise to a image?
77 次查看(过去 30 天)
显示 更早的评论
I want to apply gaussian noise to my input image? Is it possible to enhance the gaussian noise added image?
0 个评论
回答(1 个)
John BG
2016-2-27
编辑:John BG
2016-2-27
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Filtering and Enhancement 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!