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

📄 seqhaar.m

📁 matlab程序
💻 M
字号:
function X = seqhaar(X, Level, Dim)
%SEQHAAR  Sequential "S-transform" modified Haar wavelet.
%   Y = SEQHAAR(X,L) computes the L level decomposition of an integer-
%   valued signal X using the sequential-transform or "S-transform"
%   nonlinear modification of the Haar wavelet [1].  The output of the
%   transform is integer valued.  The signal length must be divisible
%   by 2^L.  If X is a matrix, the transform is applied to each column.
%
%   SEQHAAR(X,-L) is the inverse transform, reversing L levels.
%
%   SEQHAAR(X,L,DIM) applies the transform across the dimension DIM.
%
%   Note: SEQHAAR does not have perfect reconstruction for non-integer-
%   valued signals.
%
%   Example:
%   Y = seqhaar(X,3);   % Perform 3 levels of decomposition on X
%   R = seqhaar(Y,-3);  % Recover X from Y
%
%   Reference:
%   [1] Heijmans and Goutsias.  ``Nonlinear Multiresolution Signal
%       Decomposition Schemes--Part II: Morphological Wavelets.''  IEEE
%       Transactions on Image Processing, Vol. 9, No. 11, Nov. 2000.
%
%   See also SEQHAAR2, MHAAR.

% Pascal Getreuer 2005

if nargin < 2
   error('Not enough input arguments.');
end
if nargin < 3
   Dim = min(find(size(X) ~= 1));
end

XSize = size(X);
N = XSize(Dim);
Perm = [Dim:max(length(XSize),Dim) 1:Dim-1];
X = reshape(permute(X,Perm),N,prod(XSize)/N);

if rem(N,pow2(abs(Level)))
   error('Invalid input size.');
end

if Level > 0
   for k = 1:Level
      N = size(X,1)*pow2(1-k);
      X(1:N,:) = [floor((X(1:2:N,:) + X(2:2:N,:))/2);X(2:2:N,:) - X(1:2:N,:)];
   end
elseif Level < 0
   for k = Level:-1
      N = size(X,1)*pow2(k+1);
      X([1:2:N,2:2:N],:) = [X(1:N/2,:) - floor(X(N/2+1:N,:)/2);
         X(1:N/2,:) + floor((X(N/2+1:N,:)+1)/2)];
   end
end

X = ipermute(reshape(X,XSize(Perm)),Perm);

⌨️ 快捷键说明

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