adding random noise to an image for N times

6 views (last 30 days)
Melike Erdogan
Melike Erdogan on 22 Nov 2021
Answered: Bjorn Gustavsson on 22 Nov 2021
Hello. I need to learn how to add random noise to an image, to repeat this operation N times and then to reveal the results for different values of N. Thanks for your valuable time.

Answers (2)

DGM
DGM on 22 Nov 2021
Look at something like imnoise(). Decide what type of noise you need. Apply the noise in a loop.
In all likelihood, the loop can be avoided by simply choosing the appropriate parameters.

Bjorn Gustavsson
Bjorn Gustavsson on 22 Nov 2021
The question is a bit too vague to be precisely answered. Image noise typically have some specific probability-distribution, possibly in addition to dicretization-noise.
Typically it is possible to model photon-counting statistics as a random-number from a Poisson-distribution where the expected value of the photon-count is the Poisson-parameter Lambda:
imagesc
D = get(get(gca,'Children'),'CData'); % Just to get us an example-image
D1 = poissrnd(D);
D2 = poissrnd(D);
D3 = poissrnd(D);
subplot(3,2,1)
imagesc(D),colorbar
subplot(3,2,2)
imagesc(D1),colorbar
subplot(3,2,4)
imagesc(D1+D2),colorbar
subplot(3,2,3)
imagesc((D1+D2)/2),colorbar
subplot(3,2,6)
imagesc(D1+D2+D3),colorbar
subplot(3,2,5)
imagesc((D1+D2+D3)/3),colorbar
It should be possible to gather some tendensies from this simple example. I also urge you to look at the distribution of the residuals, for example:
hist((D1(:)+D2(:)-D(:))./D(:),-3:0.01:3)
From there you can/should get the courage to use the central limit theorem (surely everyones favourite statistical theorem) to dare to approximate the random-noise from something as demanding as a Poisson-process to the simple addition of a zero-centred normal-distributed random number with the standard deviation of the square-root of the expected image intensity.
After that one might start to faff-about with discretization-noise - which should not be ignored with images with 8-bit depth.
HTH

Community Treasure Hunt

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

Start Hunting!