資源簡介
這個代碼很好大家可以借鑒一下我金額發揮的技術首都機場卡斯深刻的金絲講授的堅持說四等獎考生的技術快睡覺佛孫大圣是經擦看
代碼片段和文件信息
function?y?=?noise(varargin)
%??NOISE????Adds?noise?to?an?image.
%
%?????NOISE?creates?a?new?image?by?adding?noise?to?the?original?image.
%?????NOISE?can?be?used?to?any?matrix?(1D?2D?3D?nD)
%
%?????Noisetypes?are:
%???????‘ag‘?:?additive?gaussian?(default)????‘au‘?:?additive?uniform
%???????‘mg‘?:?multiplicative?gaussian????????‘mu‘?:?multiplicative?uniform
%???????‘sp‘?:?salt?and?pepper
%
%?????Additive?noise?sums?an?random?value?to?the?image?value?at?each?pixel
%?????Multiplicative?noise?replaces?a?pixel?value?with?an?random?value
%?????Salt?and?Pepper?noise?replaces?a?pixel?value?with?the?maximum?or?minimum?possible?values.
%
%?????For?‘ag‘?noisetype?use:??y?=?NOISE(x‘ag‘?variance?[incidence])
%???????where?‘variance‘?is?the?variance?of?the?gaussian?noise?added?and?the?optional?parameter
%???????‘incidence‘?is?the?percetual?of?pixels?affected?be?the?noise?(default?for?additive?noise=1).
%???????For?a?50%?incidence?use?‘incidence‘?=?.5?and?so?on.
%
%?????For?‘au‘?noisetype?use?:??y?=?NOISE(x‘au‘?maximum?[incidence])
%???????where?‘maximum‘?is?the?maximum?value?the?uniform?noise?can?achieve
%
%?????For?‘mg‘?noisetype?use?:??y?=?NOISE(x‘mg‘?incidence)
%?????For?‘mu‘?noisetype?use?:??y?=?NOISE(x‘mu‘?incidence)
%???????Multiplicative?noisetypes?require?that?the?‘incidence‘?parameter.?For?this?kind?of?noise
%???????the?variance?or?the?maximum?(respectivelly?for?gaussian?and?uniform?noisetypes)?are?allways
%???????set?to?the?maximum?image?value.
%
%?????For?‘sp‘?noisetype?use?:??y?=?NOISE(x‘sp‘?incidence)
%
%?????The?‘maximum‘?and?‘variance‘?parameters?can?be?set?as?percentual?of?the?maximum?-?minimum?image?
%?????values?by?using?these?values?as?strings?containg?the?percentual?rate?followed?by?the?percent?symbol.
%?????The?‘incidence‘?can?also?be?expressed?as?a?pecentual?in?this?same?way
%
%?????Example:??y?=?NOISE(x‘ag‘?‘25%‘)
%???????????????y?=?NOISE(x‘mu‘?10?.5)?->?same?as?y?=?NOISE(x‘mu‘10?‘50%‘)
%
[u?noisetype??scale?incid]?=?parse_inputs(varargin{:});
if?~isa(u‘double‘)
???u?=?double(u);
end
y?=?u;
n?=?zeros(size(u));
if?incid?==?
評論
共有 條評論