function noisevar = evar(y)
%EVAR Noise variance estimation.
% Assuming that the deterministic function Y has additive Gaussian noise,
% EVAR(Y) returns an estimated variance of this noise.
%
% Note:
% ----
% A thin-plate smoothing spline model is used to smooth Y. It is assumed
% that the model whose generalized cross-validation score is minimal can
% provide the variance of the additive noise. A few tests showed that
% EVAR works very well with "not too irregular" functions.
%
% Examples:
% --------
% % 1D signal
% n = 1e6; x = linspace(0,100,n);
% y = cos(x/10)+(x/50);
% var0 = 0.02; % noise variance
% yn = y + sqrt(var0)*randn(size(y));
% evar(yn) % estimated variance
%
% % 2D function
% [x,y] = meshgrid(0:.01:1);
% f = exp(x+y) + sin((x-2*y)*3);
% var0 = 0.04; % noise variance
% fn = f + sqrt(var0)*randn(size(f));
% evar(fn) % estimated variance
%
% % 3D function
% [x,y,z] = meshgrid(-2:.05:2);
% f = x.*exp(-x.^2-y.^2-z.^2);
% var0 = 0.6; % noise variance
% fn = f + sqrt(var0)*randn(size(f));
% evar(fn) % estimated variance
%
% % Other examples
% Click <a href="matlab:web('http://www.biomecardio.com/matlab/evar.html')">here</a> for more examples
%
% Note:
% ----
% EVAR is only adapted to evenly-gridded 1-D to N-D data.
%
% See also VAR, STD, SMOOTHN
%
% -- Damien Garcia -- 2008/04, revised 2010/03
% website: <a
% href="matlab:web('http://www.biomecardio.com')">www.BiomeCardio.com</a>
error(nargchk(1,1,nargin));
d = ndims(y);
siz = size(y);
S = zeros(siz);
for i = 1:d
siz0 = ones(1,d);
siz0(i) = siz(i);
S = bsxfun(@plus,S,cos(pi*(reshape(1:siz(i),siz0)-1)/siz(i)));
end
S = 2*(d-S(:));
% N-D Discrete Cosine Transform of Y
if exist('dctn','file')
y = dctn(y);
y = y(:);
else
error('MATLAB:evar:MissingFunction',...
['DCTN is required. Download <a href="matlab:web(''',...
'http://www.biomecardio.com/matlab/dctn.html'')">DCTN</a>.'])
end
%
S = S.^2; y = y.^2;
% Upper and lower bounds for the smoothness parameter
N = sum(siz~=1); % tensor rank of the y-array
hMin = 1e-6; hMax = 0.99;
sMinBnd = (((1+sqrt(1+8*hMax.^(2/N)))/4./hMax.^(2/N)).^2-1)/16;
sMaxBnd = (((1+sqrt(1+8*hMin.^(2/N)))/4./hMin.^(2/N)).^2-1)/16;
% Minimization of the GCV score
fminbnd(@func,log10(sMinBnd),log10(sMaxBnd),optimset('TolX',.1));
function score = func(L)
% Generalized cross validation score
M = 1-1./(1+10^L*S);
noisevar = mean(y.*M.^2);
score = noisevar/mean(M)^2;
end
end
数字图像处理matlab函数-噪声估计、白平衡、gamma校正等
4星 · 超过85%的资源 需积分: 50 179 浏览量
2011-03-24
11:21:23
上传
评论 4
收藏 2KB RAR 举报
zhanghao0953
- 粉丝: 0
- 资源: 2
最新资源
- mosquitto-2.018-install-windows-x64
- FTPServer FTP 服务器,绿色免安装,单文件
- 梦畅语音点名软件,上课点名
- 利用ADNI数据集和标签,在tensorflow框架上使用tensorlayer接口,通过架构u-net实现海马体的分割
- Kutools for Word v9.0 office word 插件
- 修复Windows 10 LTSC 2021资源占用率高
- Hash工具,小巧绿色hash校验工具,免费hash工具
- 重启进行BIOS快捷方式,不需要开机按BIOS键
- 鸭子开车记(儿童绘本)
- 威纶通触摸屏编程软件Easy builder pro V6.09.01.556安装包(2024.04).txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
- 4
- 5
前往页