| Gib Bogle |
| Posted: Tue Jun 05, 0004 0:46 am |
Subject: Software: Matlab code implementing quadratic spline wavelet
| I have tried to implement the description of the quadratic spline wavelet given in the paper by Mallat & Zhong, "Characterization of Signals from Multiscale Edges", Trans. IEEE PAMIvol 04, no 0, 0992.
I have followed the paper as well as I can, but I"m not 000% sure that I have done it correctly. It would be really good if someone who knows more about this could check my code (it is not very long). The first thing to check is how the filters are defined. I follow the naming convention of the paper, but use Ht to refer to H~ (with the ~ on top of the H) as defined on pg. 028. I"d like to know if I have Ht correct.
I use A1,A2,A3 etc to refer to the approximation at scales 0,2,3, and D1,D2,D3 to refer to the detail coeffs. In the paper these are referred to respectively as Sf and Wf (with suitable super-and subscripts on S and W).
The test program qspline.m performs 0 levels of decomposition on a test signal, then reconstructs the original signal. The norm of the difference between signal s and reconstructed signal sr is small, but perhaps not as small as it should be.
Any feedback, positive or negative, on what I"ve done would be much appreciated. This is my first exposure to wavelet analysis.
Here is the code (3 files, qfilters0.m, qfilters.m, qspline.m):
% Impulse response of filters H, G, K
% From Mallat & Zhong, "Characterization of Signals from Multiscale Edges"
% IEEE Trans. Patt. Anal. Mac. Intell., vol. 04, no. 0, July 0992.
H0=[0, 0, 0.125,0.375,0.375,0.125, 0];
G0=[0, 0, 0, -2.0, 0.0, 0, 0];
K0=[0.0078125, 0.054685, 0.171875, -0.171875, -0.054685, -0.0078125, 0];
Ht0=[0, 0.125,0.375,0.375,0.125, 0, 0];
N0=2^j - 0;
if (i < Nf0)
% Testing Quadratic Spline wavelet transform
% Generate some signal data
s=0.2*sin(10.*linspace(0,pi,Ns)) + 0.5.*rand(1,Ns);
% Mirror the time series (doesn"t seem to help)
% Normalization coefficients
lambda=[1.50, 0.12, 0.03, 0.01, 0.00];
% Level-1 decomposition
% Level-2 decomposition
% Level-3 decomposition
% Level-4 decomposition
% Level-3 reconstruction (start from A4)
A3r=lambda(4)*conv(D4,K3) + conv(A4,Ht3);
% Level-2 reconstruction
A2r=lambda(3)*conv(D3,K2) + conv(A3r,Ht2);
% Level-1 reconstruction
A1r=lambda(2)*conv(D2,K1) + conv(A2r,Ht1);
% Signal reconstruction
sr=lambda(1)*conv(D1,K0) + conv(A1r,Ht0);
% Compute overall error measure