MATLAB第四次作业详细内容
1. M文件的选择
选择 Image Processing Toolbox中的 Imnoise
函数——图像噪声函数. 以下为该函数的函数名, F1行以及函数说明行.
function b = imnoise(varargin) %varargin:表示输入参数列表(输入参数个数不定,可变)
%IMNOISE Add noise to image.
% J = IMNOISE(I,TYPE,...) Add noise of a given TYPE to the intensity
% image I. TYPE is a string or char vector that can have one of these
% values:
%
% 'gaussian' Gaussian white noise with constant
% mean and variance (均值和方差)
%
% 'localvar' Zero-mean Gaussian white noise
% with an intensity-dependent variance
%
% 'poisson' Poisson noise
%
% 'salt & pepper' "On and Off" pixels
%
% 'speckle' Multiplicative noise
%
% Depending on TYPE, you can specify additional parameters to IMNOISE. All
% numerical parameters are normalized; they correspond to operations with
% images with intensities ranging from 0 to 1.
%
% J = IMNOISE(I,'gaussian',M,V) adds Gaussian white noise of mean M and
% variance V to the image I. When unspecified, M and V default to 0 and
% 0.01 respectively.
%
% J = imnoise(I,'localvar',V) adds zero-mean, Gaussian white noise of
% local variance, V, to the image I. V is an array of the same size as I.
%
% J = imnoise(I,'localvar',IMAGE_INTENSITY,VAR) adds zero-mean, Gaussian
% noise to an image, I, where the local variance of the noise is a
% function of the image intensity values in I. IMAGE_INTENSITY and VAR
% are vectors of the same size, and PLOT(IMAGE_INTENSITY,VAR) plots the
% functional relationship between noise variance and image intensity.
% IMAGE_INTENSITY must contain normalized intensity values ranging from 0
% to 1.
%
% J = IMNOISE(I,'poisson') generates Poisson noise from the data instead
% of adding artificial noise to the data. If I is double precision,
% then input pixel values are interpreted as means of Poisson
% distributions scaled up by 1e12. For example, if an input pixel has
% the value 5.5e-12, then the corresponding output pixel will be
% generated from a Poisson distribution with mean of 5.5 and then scaled
% back down by 1e12. If I is single precision, the scale factor used is
% 1e6. If I is uint8 or uint16, then input pixel values are used
% directly without scaling. For example, if a pixel in a uint8 input
% has the value 10, then the corresponding output pixel will be
% generated from a Poisson distribution with mean 10.
%
% J = IMNOISE(I,'salt &