噪声模型
模拟噪声的行为和影响的能力是图像复原的核心。
采用函数imnoise来使用噪声污染一幅图像。
噪声应用
高斯噪声在诸如低照明水平图像传感器操作等情况下被用作一种近似。
椒盐噪声由不完善的开关设备产生。
照相乳剂中的银粒大小是用对数正态分布描述的随机变量。
瑞利噪声产生于波段成像。
指数和厄兰噪声在描述激光成像中的噪声方面是很有用的。
相关函数
A = rand( M , N ); % 生成M×N的数组,元素在区间(0,1)均匀分布。
A = randn( M , N ); % 生成M×N的数组,元素是零均值、单位方差的正态(高斯)数。
I = find(A); % 返回I中所有数组A的索引,没找到则返回一个空矩阵。
[r,c] = find(A); % 返回矩阵A的非零元素的行和列索引。
[r,c,v] = find(A); % 除了返回行索引和列索引,还以列向量v返回A的非零值。
I = find(A<128); % 示例1
A(I)=0; % 寻找图像中值小于128的像素并把它们置零。
I = find(A>=64&A<=192); % 示例2
A(I) = 128; % 将闭区间[64,192]的所有像素置为128。
使用指定的分布产生空间随机噪声(函数imnoise2)
该函数生成一个大小为M×N的噪声数组R,不以任何形式缩放。imnoise输出一个有噪声的图像,而imnoise2产生噪声模式本身。
function R = imnoise2(type, M, N, a, b)
%IMNOISE2 Generates an array of random numbers with specified PDF.
% R = IMNOISE2(TYPE, M, N, A, B) generates an array, R, of size
% M-by-N, whose elements are random numbers of the specified TYPE
% with parameters A and B. If only TYPE is included in the
% input argument list, a single random number of the specified
% TYPE and default parameters shown below is generated. If only
% TYPE, M, and N are provided, the default parameters shown below
% are used. If M = N = 1, IMNOISE2 generates a single random
% number of the specified TYPE and parameters A and B.
%
% Valid values for TYPE and parameters A and B are:
%
% 'uniform' Uniform random numbers in the interval (A, B).
% The default values are (0, 1).
% 'gaussian' Gaussian random numbers with mean A and standard
% deviation B. The default values are A = 0, B = 1.
% 'salt & pepper' Salt and pepper numbers of amplitude 0 with
% probability Pa = A,