idwt_dim.m

来自「小波压缩编码平台软件包」· M 代码 · 共 43 行

M
43
字号
function X = idwt_dim(X,d,wavelet)
%X = idwt_dim(X,d,wavelet)
%Version: 1.10, Date: 2006/01/31, author: Nikola Sprljan
%IDWT in specific dimension of an n-dimensional matrix
%
%Input: 
% X - matrix of wavelet coeffcients
% d - dimension in which the transform will take place
% wavelet - wavelet identification string, or wavelet data structure
%     
%Output: 
% X - reconstructed matrix
% 
%Uses: 
% load_wavelet.m (Wavelet Toolbox)
% idwt_lifting1D.m (Wavelet Toolbox)
% subband_dim.m (Wavelet Toolbox)
%
%Example:
% X = idwt_dim(Y,1,'Haar');

%load the wavelet here
if (isstr(wavelet))
    wvf = load_wavelet(wavelet);
else
    wvf = wavelet;
end;

N = ndims(X);
dimprod = prod(size(X));
X = shiftdim(X,d-1); %rotates the order of dimensions
sv = size(X); %matrix size before reshaping
sizdim = sv(1); %size of the first dimension
if sizdim > 1 %if non-singleton dimension
    sizcol = dimprod/sizdim; %product of other dimensions
    X = reshape(X,sizdim,sizcol); %reshape into 2D sizdim x sizcol matrix
    [lpasiz,hpasiz] = subband_dim(sizdim, 1);
    for j=1:sizcol   
        X(:,j) = idwt_lifting1D(X(1:lpasiz,j),X(lpasiz+1:sizdim,j),wvf);
    end;
    X = reshape(X,sv);    
end;
X = shiftdim(X,N-d+1); %rotates the order of dimensions forward to the original

⌨️ 快捷键说明

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