How to add Impulse noises in image by MATLAB?

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.


这应该工作,如果我正确地得到你的问题

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])
链接地址: http://www.djcxy.com/p/79612.html

上一篇: C#

下一篇: 如何在MATLAB中添加图像中的脉冲噪声?