hssa1.m

来自「这是伯克里wavelet transforms一书中的例子的代码」· M 代码 · 共 47 行

M
47
字号
function an = hssa1(img,al,ah)
%an = hssa1(array,lpf,hpf) effects a 1 level 2-D separable DWT of the 
%input array using the HSS biorthogonal filters defined by the filters 
%lpf and hpf. The output of the routine is returned to the array, an.
%Symmetric extension used to extend the data.
%
%This routine is used by the routine analh2d.
%
%Author: Ajit S. Bopardikar
%Copyright (c) 1998 by Addison Wesley Longman, Inc.
%

  [m,n]=size(img);
  ll = length(al);
  lh = length(ah);

  le = ll/2;
  he = lh/2;

  %first the rows

  extl = [img(:,le:-1:1) img img(:,n:-1:n-le+1)];%symmetric extension for
  exth = [img(:,he:-1:1) img img(:,n:-1:n-he+1)];%LP and HP subbands

  lo = conv2(extl,al); %lowpass subband
  hi = conv2(exth,ah); %highpass subband

  if (le/2 ~= round(le/2)) % if center is odd
    anr = [lo(:,ll:2:ll+n) hi(:,lh+2:2:lh+n-1)]'; 
  else %if center is even 
    anr = [lo(:,ll+1:2:n+ll) hi(:,lh+1:2:lh+n-1)]';
  end %end if - this completes the row decomposition

  %now for the columns
  extl = [anr(:,le:-1:1) anr anr(:,m:-1:m-le+1)];
  exth = [anr(:,he:-1:1) anr anr(:,m:-1:m-he+1)];

  lo = conv2(extl,al); %lowpass subband
  hi = conv2(exth,ah); %highpass subband

  if (le/2 ~= round(le/2)) % if center is odd
    an = [lo(:,ll:2:ll+m) hi(:,lh+2:2:lh+m-1)]'; 
  else %if center is even 
    an = [lo(:,ll+1:2:m+ll) hi(:,lh+1:2:lh+m-1)]';
  end %end if - this completes the column decomposition
   
  

⌨️ 快捷键说明

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