Reputation: 137
I have few confusion and question about adding impulse noise in images using Matlab. I read that the impulse in image categorized in two:
a) salt and pepper ( corruption have graylevel pixel equal to 0 or 255)
b) random valued impulse noise ( where the corrupted pixel can have any value between 0 to 255).
Note: I am talking about grayscale image only.
Till now, I added salt and pepper noise in image with different noise density using Matlab, using the following command:
imnoise(image, 'salt & pepper',0.5)
So I have a question:
1) how can i add random valued impulse noise in gray scale image with Matlab software?
2) Can a gray scale image corrupted by both noises simultaneously ? If yes, then how with Matlab software?
Thank You.
Upvotes: 1
Views: 1924
Reputation: 170
this should work if I got your question correctly
I = im2double(rgb2gray(imread('peppers.png')));
p = 0.2; % p between 0 and 1
Ir = (I + p*rand(size(I)))/(1+p);
imshow([I Ir])
Upvotes: 0