📄 compute_impulse_noise.m
字号:
function M = compute_impulse_noise(M,p,sigma,mu)% compute_impulse_noise - add impulse noise to an image%% M = compute_impulse_noise(M,p,sigma,mu);%% p is the probability that one pixel is corrupted.% sigma is the deviation of the corrupted pixels (uniform noise)% mu is the mean%% Copyright (c) 2007 Gabriel Peyreif nargin<2 p = 0.05;endif nargin<3 sigma = max(M(:)) - min(M(:)); endif nargin<4 mu = (max(M(:)) + min(M(:)))/2;endn = size(M);t = randperm(n^2); t = t(1:round(p*n^2));M = M0;% Mn(t) = mu + sigma*randn(length(t),1);M(t) = rand(length(t),1)*sigma + mu;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -