compute_impulse_noise.m

来自「A toolbox for the non-local means algori」· M 代码 · 共 26 行

M
26
字号
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 + =
减小字号Ctrl + -
显示快捷键?