MATLAB Answers


matlab code to generate background noise in a color image

Asked by ARUN SAI
on 19 May 2013

provide the code to generate background noise ie, white spot like in a color image




No products are associated with this question.

2 Answers

Answer by Image Analyst
on 19 May 2013

Were my responses in your duplicate question not what you were looking for? You could have continued the discussion there instead of posting a new question like it's brand new.


Answer by Michael Nauheimer on 19 May 2013

How much noise is wanted? And do you want Gaussian white noise or just random noise?

If you image data is saved in A, I would say you could add Gaussian white noise by doing as shown below.

thesize = size(A);
noisesize = 20; % You choose!
for i = 1:3;
  Y(:,:,i) = uint8(double(A(:,:,i))+wgn(thesize(1),thesize(2),noisesize));

And then you output data should be in Y with white noise added.

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!