## 3D Wavelet Transform via Linear Algebra

Hello, I am putting this out there to see if anyone can help me take my linear algebra solution to the wavelet transform from 2D to 3D. The reason I am doing this is because there is no lwt3 function in the wavelet toolbox, and dwt3 does not organize the coefficients in a way that I would prefer.

The equations for 1D and 2D are fairly simple. Working with an operator "L" and "H" which are N/2 by N, one can perform the 1D by multiplying the vector by the transpose of the operator. In 2D you perform L*X*L’ for every combination of L and H (resulting in 4, N/2 by N/2 matrices). Here is some code demonstrating 1D and 2D, if anyone could help me figure out 3D it would be greatly appreciated.

%% Datasets

X1 = reshape(1:4,1,4);

X2 = reshape(1:16,4,4);

X3 = reshape(1:64,4,4,4);

%% Get Operators

ls = liftingScheme(‘Wavelet’,’db2′);

[LoD,HiD,LoR,HiR] = ls2filt(ls);

L = operator(LoD,4);

H = operator(HiD,4);

%% 1D transform

l = X1*H’;

h = X1*L’;

%% 2D transform

ll = L*X2*L’;

lh = H*X2*L’;

hl = L*X2*H’;

hh = H*X2*H’;

%% 3D transform???

%% FUNCTIONS

function L = operator(a,N)

L = zeros(N/2,N);

for i = 1:N/2

L(i,2*(i-1)+1:2*(i-1)+numel(a)) = a;

end

L = L(:,1:N) + [L(:,N+1:N+floor(numel(a)/2)),zeros(N/2,N-floor(numel(a)/2))];

endHello, I am putting this out there to see if anyone can help me take my linear algebra solution to the wavelet transform from 2D to 3D. The reason I am doing this is because there is no lwt3 function in the wavelet toolbox, and dwt3 does not organize the coefficients in a way that I would prefer.

The equations for 1D and 2D are fairly simple. Working with an operator "L" and "H" which are N/2 by N, one can perform the 1D by multiplying the vector by the transpose of the operator. In 2D you perform L*X*L’ for every combination of L and H (resulting in 4, N/2 by N/2 matrices). Here is some code demonstrating 1D and 2D, if anyone could help me figure out 3D it would be greatly appreciated.

%% Datasets

X1 = reshape(1:4,1,4);

X2 = reshape(1:16,4,4);

X3 = reshape(1:64,4,4,4);

%% Get Operators

ls = liftingScheme(‘Wavelet’,’db2′);

[LoD,HiD,LoR,HiR] = ls2filt(ls);

L = operator(LoD,4);

H = operator(HiD,4);

%% 1D transform

l = X1*H’;

h = X1*L’;

%% 2D transform

ll = L*X2*L’;

lh = H*X2*L’;

hl = L*X2*H’;

hh = H*X2*H’;

%% 3D transform???

%% FUNCTIONS

function L = operator(a,N)

L = zeros(N/2,N);

for i = 1:N/2

L(i,2*(i-1)+1:2*(i-1)+numel(a)) = a;

end

L = L(:,1:N) + [L(:,N+1:N+floor(numel(a)/2)),zeros(N/2,N-floor(numel(a)/2))];

end Hello, I am putting this out there to see if anyone can help me take my linear algebra solution to the wavelet transform from 2D to 3D. The reason I am doing this is because there is no lwt3 function in the wavelet toolbox, and dwt3 does not organize the coefficients in a way that I would prefer.

The equations for 1D and 2D are fairly simple. Working with an operator "L" and "H" which are N/2 by N, one can perform the 1D by multiplying the vector by the transpose of the operator. In 2D you perform L*X*L’ for every combination of L and H (resulting in 4, N/2 by N/2 matrices). Here is some code demonstrating 1D and 2D, if anyone could help me figure out 3D it would be greatly appreciated.

%% Datasets

X1 = reshape(1:4,1,4);

X2 = reshape(1:16,4,4);

X3 = reshape(1:64,4,4,4);

%% Get Operators

ls = liftingScheme(‘Wavelet’,’db2′);

[LoD,HiD,LoR,HiR] = ls2filt(ls);

L = operator(LoD,4);

H = operator(HiD,4);

%% 1D transform

l = X1*H’;

h = X1*L’;

%% 2D transform

ll = L*X2*L’;

lh = H*X2*L’;

hl = L*X2*H’;

hh = H*X2*H’;

%% 3D transform???

%% FUNCTIONS

function L = operator(a,N)

L = zeros(N/2,N);

for i = 1:N/2

L(i,2*(i-1)+1:2*(i-1)+numel(a)) = a;

end

L = L(:,1:N) + [L(:,N+1:N+floor(numel(a)/2)),zeros(N/2,N-floor(numel(a)/2))];

end wavelet, 3d, linear-algebra, mathematics, lifting-scheme MATLAB Answers — New Questions