0
votes

I am trying to add gaussian noise to an image using the pdf model. I have searched for hours but the only thing I get is either imnoise or a manual code as below:

Inoise = Orig_img + (sqrt(variance)*randn(size(Orig_img)) + mean);

The pdf for gausssian noise is:

pdf of gaussian

Any way I can use this to generate noise in an image

2
What's the problem with using imnoise? - Buddhima Gamlath
I am trying to learn how to add without using built-in commands - user2743295
It's better not to use mean as a variable name. It's the name of a Matlab function. And you can remove the outer parentheses. Other than that, it's the way to go - Luis Mendo

2 Answers

0
votes

The code you have given is correct. You can do the same with

mu    = ...
sigma = ...
im_with_noise = im_original + normrnd(mu,sigma, size(im_original));
0
votes

So the only solution (and correct one) found is

Inoise = Orig_img + (sqrt(variance)*randn(size(Orig_img)) + mean);

pdf are only meant to see the noise shape, pattern etc.