Home > NoiseTools > nt_multiscale.m

nt_multiscale

PURPOSE ^

z=nt_multiscale(x,depth) - apply smoothing at multiple scales

SYNOPSIS ^

function z=nt_multiscale(x,depth)

DESCRIPTION ^

z=nt_multiscale(x,depth) - apply smoothing at multiple scales

   y: result

   x: data
   depth: depth of scales to investigate
 
 NoiseTools

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function z=nt_multiscale(x,depth)
0002 %z=nt_multiscale(x,depth) - apply smoothing at multiple scales
0003 %
0004 %   y: result
0005 %
0006 %   x: data
0007 %   depth: depth of scales to investigate
0008 %
0009 % NoiseTools
0010 
0011 if nargin<2; error('!'); end
0012 
0013 if ndims(x)==3;
0014     [m,n,o]=size(x);
0015     z=zeros(m-2^depth-1,n*depth,o);
0016     for k=1:o
0017         z(:,:,k)=nt_multiscale(x(:,:,k),depth);
0018     end
0019     return
0020 end
0021     
0022 [m,n]=size(x);
0023 z=zeros(m,n,depth);
0024 
0025 z(:,:,1)=x(1:size(z,1),:);
0026 for k=1:depth-1
0027     step=2^k-1;
0028     idx=1:(m-step);
0029     z(idx,:,k+1) = (...
0030         z(idx,:,k) + ...
0031         z(idx+step,:,k) )/2;
0032 end
0033 
0034 z=reshape(z,[m,n*depth]);
0035 z=z(1:end-2^depth-1,:);

Generated on Mon 10-Nov-2014 14:40:42 by m2html © 2005