【MATLAB】图像处理相关函数imnoise2函数

本文深入探讨了MATLAB中的imnoise2函数,该函数用于向图像添加不同类型的噪声。我们讨论了其参数用法,包括各种噪声模型如高斯噪声、椒盐噪声等,并通过实例展示了如何使用imnoise2来模拟和分析图像噪声的影响。
摘要由CSDN通过智能技术生成
function R = imnoise2(type, M, N, a, b)
% IMNOISE2 Generates an array of random number 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 defalut
%   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 defalut
%               value are (0, 1).
%   'gaussian'  Gaussian random numbers with mean A and standard deviation
%               B. The default values are A = 0, B = 1.
% 'salt & pepper' Sa
  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
function R = imnoise2(type, varargin) %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, and amplitude 1 with % probability Pb = B. The default values are Pa = % Pb = A = B = 0.05. Note that the noise has % values 0 (with probability Pa = A) and 1 (with % probability Pb = B), so scaling is necessary if % values other than 0 and 1 are required. The noise % matrix R is assigned three values. If R(x, y) = % 0, the noise at (x, y) is pepper (black). If % R(x, y) = 1, the noise at (x, y) is salt % (white). If R(x, y) = 0.5, there is no noise % assigned to coordinates (x, y). % 'lognormal' Lognormal numbers with offset A and shape % parameter B. The defaults are A = 1 and B = % 0.25. % 'rayleigh' Rayleigh noise with parameters A and B. The % default values are A = 0 and B = 1. % 'exponent
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ThetaQing

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值