synthesize.m

来自「3D shape reconstruction matlab code. It 」· M 代码 · 共 53 行

M
53
字号
function [I,J] = synthesize(radiance,Sigma2,...
    modelnoise,sensornoise,Nit)
% The following code generates synthetic blurred images 
% via diffusion
%
% Copyright 2006 Paolo Favaro (p.favaro@hw.ac.uk)
% 
% School of Engineering and Physical Sciences
% Heriot-Watt University, Edinburgh, UK
% 
% Last revision: August 2006
%
% This program can be used only for research purposes.
% This program is distributed WITHOUT ANY WARRANTY; 
% without even the implied warranty of MERCHANTABILITY 
% or FITNESS FOR A PARTICULAR PURPOSE.

% set image size
if nargin<3
    modelnoise = 0;
end
if nargin<4
    sensornoise = 0;
end
if nargin<5
    Nit = 5;
end
[m,n,three] = size(radiance);

di = .1;
I = zeros(m,n,three);
% search for max number of iterations (Nit)
for k = 1:three
    Sigma2 = Sigma2.*(Sigma2>0);
    DiffCoeff(:,:,k) = Sigma2;
    if (Nit<ceil(max(Sigma2(:))/di))
        Nit = ceil(max(Sigma2(:))/di);
    end
end
if Nit>30
    errmsg = sprintf(...
        ['Current simulation requires %d iterations!\n' ...
        'To proceed change max number of iterations in' ...
        ' function synthesize.m'],Nit);
    error(errmsg);
end
% simulate diffusion
for k = 1:three
    [I(:,:,k),J(:,:,:,k)] = diffusion(radiance(:,:,k)+...
        modelnoise*randn(m,n),DiffCoeff(:,:,k),Nit,...
        sensornoise*randn(m,n));
end
return

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?