📄 subband.m
字号:
function [S,Sind,Sdim]=subband(D,N,band)
%S = subband(D,N,band)
%Version: 3.00, Date: 2005/01/01, author: Nikola Sprljan
%Selects a subband from a 2D wavelet coefficients array
%
%Input:
% D - array of wavelet coefficients
% N - specifies the decomposition level
% band - specifies the subband ('ll', 'hl', 'lh' or 'hh')
%
%Output:
% S - array of the subband wavelet coefficients
% Sind - indices of elements of the selected subband
% Sdim - dimensions of the selected subband
%
%Note:
% ('ll', 'hl', 'lh', 'hh') corresponds to ('a', 'h', 'v' ,'d')
%
%Example:
% D=dwt_dyadic_decomp(A,'CDF_9x7',4);
% S=subband(D,4,'hl');
% S=subband(D,6,'ll');
if (ndims(D) ~= 2)
error('Wavelet coefficients array of other dimensions than 2D!');
end;
[sizrow,sizcol] = size(D);
[ldr,hdr]= subband_dim(sizrow, N);
[ldc,hdc]= subband_dim(sizcol, N);
switch band
case 'll'
Sind{1} = 1:ldr;
Sind{2} = 1:ldc;
Sdim = [ldr ldc];
case 'hl'
Sind{1} = 1:ldr;
Sind{2} = ldc+1:ldc+hdc;
Sdim = [ldr hdc];
case 'lh'
Sind{1} = ldr+1:ldr+hdr;
Sind{2} = 1:ldc;
Sdim = [hdr ldc];
case 'hh'
Sind{1} = ldr+1:ldr+hdr;
Sind{2} = ldc+1:ldc+hdc;
Sdim = [hdr hdc];
end;
S = D(Sind{:});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -