⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imkindex.m

📁 该代码为图像融合的vc源程序,对学习图像融合有很重要的价值
💻 M
字号:
function [lpf,hpf,s2]=imkindex(N,c_c_min,c_c_max,c_u_min,c_u_max, edge)
%$Id: imkindex.m,v 1.1.1.1 2000/10/16 09:30:40 mattb Exp $
%===========================================================================
%                   Matt Bowers - University of Bath
%
%                        Copyright (c) 1996
%===========================================================================
%
% Creates the matrices used by 'iwt2dscl' to index the input to the transform
%
% Arguements:
%   N           length of input data to transform
%   c_c_min     }   
%   c_c_max     } these are the min and max filter tap numbers for c_c and c_u 
%   c_u_min     }
%   c_u_max     }
%   edge        defines edge handling - as defined in 'iwt2dscl'
%
% Returns:
%   lpf         the indexing matrix for low band synthesis filter
%   hpf         the indexing matrix for high band synthesis filter
%   s2          sign flipping matrix used for high band synthesis filter
%===========================================================================

hpfiltlen=c_c_max-c_c_min+1;	% Filter length
lpfiltlen=c_u_max-c_u_min+1;	% Filter length

half_N=fix(N/2);		% Half N

% should work for any wavelet having correct analysis:synthesis length combination.
if rem(c_c_min,2)   %analysis filter starts on an odd index
  lpoffset=1;
  hpoffset=1;
else   %analysis filter starts on an even index
  lpoffset=2;
  hpoffset=2;
end
% for invalid anal:syn length combinations, replace 1 1    2 2 above by 2 1   1 2.

%Low pass:
kumin=ceil((-c_u_max)/2 -0.25); 	% Create data stream index vectors with required reflection at edges
kumax=floor((N-1-c_u_min)/2 +0.25);
idx = [kumin:kumax+1];
if edge==2
  [idx dummy]=rfl_22(idx,half_N);
elseif edge==1
  idx=rfl_12(idx,half_N);
else
  idx=wrap(idx,half_N);
end	
lstream=idx+1;				% Low pass stream index vector
ilstream=ones(1,length(idx)*2)*(N+1);	% Interpolate streams with index-to-zero-value token N+1
ilstream(lpoffset:2:length(ilstream))=lstream;

%High Pass:
kcmin=ceil((c_c_min-1)/2 - 0.25);
kcmax=floor((c_c_max+N-2)/2 +0.25);
idx= [kcmin:kcmax+1];
if edge==2
  [idx s2]=rfl_22(idx,half_N);
elseif edge==1
  idx=rfl_21(idx,half_N);
  s2=ones(length(idx),1);
else
  idx=wrap(idx,half_N);
  s2=ones(length(idx),1);
end	
hstream=half_N+idx+1;			% High pass stream index vector
ihstream=ones(1,length(idx)*2)*(N+1);	% Interpolate streams with index-to-zero-value token N+1
ihstream(hpoffset:2:length(ihstream))=hstream;
is2=zeros(1,length(s2)*2);
is2(hpoffset:2:length(is2))=s2;

lpf=zeros(N,lpfiltlen);			% Now construct lpf and hpf from stream indices
hpf=zeros(N,hpfiltlen);
s2=hpf;
for x=0:(N-1)
  lpf(x+1,:)=ilstream(x+1:x+lpfiltlen);
  hpf(x+1,:)=ihstream(x+1:x+hpfiltlen);
  s2(x+1,:)=is2(x+1:x+hpfiltlen);
end

⌨️ 快捷键说明

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