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

📄 tdfbdec_l.m

📁 PDTDFB toolbox The filter bank is described in: The Shiftable Complex Directional Pyramid—Pa
💻 M
字号:
function y = tdfbdec_l(x, n, dfbtype, fname)% TDFBDEC_L   Directional Filterbank Decomposition using Ladder Structure%%	y = dfbdec_l(x, f, n)%% Input:%   x:      input image%   n:      number of decomposition tree levels%   dfbtype:   'primal' or 'dual', correspond to the type of the dual pdfb%   fname:  filter name to be called by DFILTERS%% Output:%   y:	    subband images in a cell vector of length 2^n%if (n ~= round(n)) | (n < 0)    error('Number of decomposition levels must be a non-negative integer');endif n == 0    % No decomposition, simply copy input to output    y{1} = x;        return;end% Ladder filterif isstr(fname)    f = ldfilter(fname);end% Tree-structured filter banksif n == 1    % Simplest case, one level    [y{1}, y{2}] = fbdec_l(x, f, 'q', '1r', 'per');else    % For the cases that n >= 2    % First level    % For the cases that n >= 2    if strcmp(dfbtype, 'dual')        [g0, g1] = dfilters('meyerh2', 'd');        [g2, g3] = dfilters('meyerh3', 'd');        % First level        % remove aliasing on the high frequency        %[x0, x1] = fbdec(x, [k0; zeros(2,size(k0,2))], [k1, zeros(size(k1,1),2)] , 'q', '1r', 'per');        % complex filter        x = circshift(x, [-1 0]);        [x0, x1] = fbdec_l(x, f, 'q', '1r', 'per');                xex = extend2(x1, 1, 0, 0, 0,'per');        x1 = xex(1:end-1,:);                % Second level        y = cell(1, 4);        [y{1}, y{2}] = fbdec(x0, g0, g1, 'q', '2c', 'qper_col');        y{2} = circshift(y{2}, [1, 1]);        [y{3}, y{4}] = fbdec(x1, g2, g3, 'q', '2c', 'qper_col');        y{4} = circshift(y{4}, [1, 0]);    else        [x0, x1] = fbdec_l(x, f, 'q', '1r', 'qper_col');        % Second level        y = cell(1, 4);        [y{2}, y{1}] = fbdec_l(x0, f, 'q', '2c', 'per');        [y{4}, y{3}] = fbdec_l(x1, f, 'q', '2c', 'per');        y{3} = circshift(y{3}, [0 1]);    end    % Now expand the rest of the tree    for l = 3:n        % Allocate space for the new subband outputs        y_old = y;        y = cell(1, 2^l);        % The first half channels use R1 and R2        for k = 1:2^(l-2)            i = mod(k-1, 2) + 1;            [y{2*k}, y{2*k-1}] = fbdec_l(y_old{k}, f, 'p', i, 'per');        end        % The second half channels use R3 and R4        for k = 2^(l-2)+1:2^(l-1)            i = mod(k-1, 2) + 3;            [y{2*k}, y{2*k-1}] = fbdec_l(y_old{k}, f, 'p', i, 'per');        end        % circlular shift to make the subband has minimum delay        for inl = 1:4:2^(l-1)            y{inl} = circshift(y{inl}, [0 1]);        end        for inl = 2^(l-1)+1:4:2^(l)            y{inl} = circshift(y{inl}, [1 0]);        end        for l2 = l:-1:4            for inl = 1:2:2^(l-2);                csh = cshift(l2,abs(2^(l-2)-inl) );                y{inl} = circshift(y{inl}, [0 csh]);            end            for inl = 2^(l-2)+1:2:2^(l-1);                csh = cshift(l2,abs(2^(l-2)-inl) );                y{inl} = circshift(y{inl}, [0 -csh]);            end            for inl = 2^(l-1)+1:2:3*2^(l-2);                csh = cshift(l2,abs(3*2^(l-2)-inl));                y{inl} = circshift(y{inl}, [csh 0]);            end            for inl = 3*2^(l-2)+1:2:2^(l);                csh = cshift(l2,abs(3*2^(l-2)-inl));                y{inl} = circshift(y{inl}, [-csh 0]);            end        end    endend% Backsamplingy = backsamp(y);% Flip the order of the second half channelsy(2^(n-1)+1:end) = fliplr(y(2^(n-1)+1:end));%---------------------------------function csh = cshift(l2, re)if l2 == 4    csh = 1;else     % if rem < 4    %    csh = 0;    % else    %    csh = 2;    % end    if l2 == 5    tmp = floor(re/4);    csh = 2^(l2-4)*tmp;    else        csh = 0;    endend

⌨️ 快捷键说明

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