Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

A comparative study of current Matlab and

C++ wavelet software

Lubomir T. Dechevsky1 , Niklas Grip1 , and Ewald Quak2


1
Narvik University College, P.O.B. 385, N-8505 Narvik, Norway {ltd@hin.no,
grip@sm.luth.se}
2
SINTEF Applied Mathematics, Department of Geometry, P.O.Box 124 Blindern,
N-0314 Oslo, NORWAY Ewald.Quak@math.sintef.no

Summary. For anyone planning to either write or use software for wavelet-related
computations, it can be worthwhile to first find out what software are already avail-
able. There is in a number of general-purpose wavelet packages written for high-level
languages like Matlab, Mathematica and XploRE, as well as several smaller but
more specialized libraries for low-level languages, such as C++. In this text, we
present a comparative overview of available Matlab and C++ software.

1 Introduction
Today, it is (almost too) simple for “anyone” to make a web-page and make
all their source code available on the Internet. This makes it easier to get an
overview of what is already done in a particular language, but it also gets
increasingly more difficult to find out what is actually done. For example,
an early version of the following overview was a technical report with short
summaries of 55 different wavelet software. This broad overview contained
a few binaries, but mainly consisted of software available as source code for
C, C++, Java, IDL, Matlab, S+, Mathematica, Mathcad and XploRe. The
available documentation ranged from the 934 page user’s guide for the wavelet
toolbox to some very sparsely documented and commented alpha or beta
version research software. A detailed comparison of what each software could
or could not do was simply not possible.
Still, it is our strong belief that in order to avoid reinventing the wheel or
repeating old mistakes, one should not start a big software project without
first investigating what is done before. So in the next stage we made a more
direct comparison of 10 C++ libraries, the wavelet extensions available in
XploRe, 7 Matlab- and 3 Mathematica-packages for wavelet applications. This
comparison was done in the form of a large (2.5 landscape A1 papers) table,
which then was condensed down to the much smaller table presented here.
In this comparison is restricted to Matlab and C++. One reason for this
is that our current main goal is to write a wavelet extension for a SINTEF
2 Lubomir T. Dechevsky, Niklas Grip, and Ewald Quak

library for spline-based 3D geometric modeling. Matlab is a nice environment


for quick software development, which also have the most complete coverage of
wavelet software available (in the form of both free and commercial toolboxes)
as well as a Matlab-to-C++ compiler. Still, some of the required code goes
beyond the graphical capabilities of Matlab so our C++ library is needed
from the start and gradually, initial Matlab parts will be replaced by more
optimized C++ code.
The final goal is a rather general-purpose C++ wavelet library (like the
biggest Matlabtoolboxes in our comparison) with main focus on 3D geo-
metric visualization and statistical applications. Contrary to current general-
purpose software, general algorithms will be implemented for an arbitrary
number of dimensions instead of the usual one and two dimensions needed for
standard signal and image processing applications.

2 Comparison and conclusions

In the following table, we compare some wavelet toolboxes and libraries. Some
of these comparison needs some more explanation:
Type of code: The investigated packages can be divided in three different
types of code. The commercial software (here only the Wavelet Tool-
box) are well documented, general-purpose and the included algorithms
and tools have rather complete implementations, contrary to most of the
research software, which is written mainly for the authors’ research needs.
Many of these packages are alpha or beta versions, the implementations
may be restricted to what the authors has needed for their publications
or had time to do and the documentation and commenting of the source
code ranges from good to nearly nonexistent. The most complete and
well documented research software, like WaveLab, is still not comparable
to Wavelet Toolbox in this aspect, but they are a good (and free) com-
plement. For example, the important matching pursuit for wavelet and
cosine packets is included in WaveLab but not in Wavelet Toolbox. Some
och the software, finally, is tutorial in the sense that the author has writ-
ten it to learn the subject himself or to explain the algorithms to others,
but do not claim that the implementations are optimal in any way. The
documentation can, however, be much more explanatory than in many
of the research software packages, however, although one has to keep in
mind who is writing and for what purpose. For example, as Ian Kaplan
describes in the documentation for his software package, he is an expe-
rienced C++ programmer sharpening his skills in Java, who is learning
wavelets by implementing the algorithms, but with some lacks in the un-
derstanding of the mathematical details. Hence, this is not the best place
to learn those details, but it contains many references and inspiring de-
scriptions of different applications and some discussions of pros and cons
A comparative study of current Matlab and C++ wavelet software 3

of C++ and Java. Moreover, the actual code may very well be a good
source of ideas for an efficient implementation of the actual algorithms.
Generality: All investigated general-purpose programs are implemented in
Matlab, which is well suited for quick but yet powerful implementations.
Much of what is available at the fingertips of the Matlab programmers
must be implemented from scratch by the C++ programmers, so these
packages are specialized to a more restricted scope of use.
Niche: Here we list some special characteristics of each software.
The documentation and code readability vary quite a lot. One extreme is
the Wave++ software, whose authors put speed before anything, includ-
ing readability. They avoid the more object-oriented parts of C++ and,
essential use only “. . . the features of C which allow for faster running
code such as pointer arithmetic. Therefore some of the code itself may
be difficult to read; we ask only that you trust us when we say that it
has been tested. We have striven for speed in this code, not readability.
. . . Wave++ is a carefully designed, thoroughly tested portable library of
reusable, extensible algorithms and data structures . . . ”.
The usability of the code is therefore often difficult to judge, except in some
extreme cases. Also for the well-documented and more transparent code, it
depends much on the reader’s prerequisites in Matlab, C++ and wavelet
theory, whether any time can be saved by reading a given toolbox or
library before doing an implementation of ones own. The table is more
intended as an overview of what can be found where and then we leave it
to the reader to make final decisions about what to read more carefully.
The remaining table describes the main computational tools available in each
library and toolbox.

Notation

In the following table, we use the acronyms (I)CWT, (I)DWT, (I)DFT, DCT
and FFT for the (inverse) continuous wavelet transform, discrete wavelet
transform, Discrete Fourier transform, discrete cosine transform and Fast
Fourier Transform, respectively. The acronyms WP and CP denote wavelet
packets and cosine packets. A closer description of terms like these and
Gabor dictionaries can be found in a large number of books, such as,
[Mal99, OS89, Grö00].
4

Table 1. Wavelet software comparison


Package Wavelet WaveLab Rice W.T. Wave++ MSLib WAILI ImageLib WICCK Ian Kaplan DPhil WAT Liftpack
Toolbox [DRDH+ 99] [BCF+ 02] [FKK00] [UVJ+ 02] [UVWJ99] [Woh02] [DDH97] [Kap02] [Die03] [KS01] [FPS98]
[MOPM03]
Language Matlab Matlab Matlab, C C++ C++ C++ C++ C++ C++, Java C++ C++ C++
Updated Continuously August 1999 Dec 1, 2002 2000-01-31 2002-08-12 1999-10-03 March 2002 1997-01-29 March 2002 July 2003 2001-06-05 1998-04-17
updated
source code $$$ Free Free Free Free, GNU Free, GNU Free, GNU Free Free Free, GNU Free Free
Main in-
tended
application
Signal 1D, 2D 1D, 2D 1D, 2D 1D — 2D 2D 2D 1D, 2D 2D 1D 1D, 2D
process- compression
ing
Elliptic 1D
operator
equa-
tions
Generality Very general Very general General Specialized Specialized Specialized Specialized Specialized General Specialized General (?) Specialized

Type Commercial Research Research Research Research Research Research Research Tutorial Research Research Research
Niche Expensive Specialized 1D and 2D Mainly C- Image For (I)DWT 6 years Written by Wavelet So far,
but com- for the wavelet and features process- and other old alpha an experi- transforms real-valued
plete library authors’ filter bank of C++. ing using image version. enced C++ on images signals only.
with fast papers but design, anal- Fast but the lifting process- programmer with some
execution yet rather ysis, and unreadable? scheme and ing tasks. with special extras, such
(via com- complete. processing. symmetric “Highly attention, as simple
piler) and extention modular and e.g., to statistics
outstanding for DWT- prepared efficient and ex-
help and computations for later and reliable traction of
documenta- (see add-ons and garbage col- sub-bands
tion. [UVW99] improve- lection using from a
for full ments.” a memory transformed
details). pool. image.
Matlab cmd=Standard Matlab command •=included nD=n-dimensional GUI=graphical user interface Continued on next page. . .
Lubomir T. Dechevsky, Niklas Grip, and Ewald Quak
Table 1 (Wavelet software comparison) – continued from previous page
Package Wavelet WaveLab Rice W.T. Wave++ MSLib WAILI ImageLib WICCK Ian Kaplan DPhil WAT Liftpack
Toolbox [DRDH+ 99] [BCF+ 02] [FKK00] [UVJ+ 02] [UVWJ99] [Woh02] [DDH97] [Kap02] [Die03] [KS01] [FPS98]
[MOPM03]
Language Matlab Matlab Matlab, C C++ C++ C++ C++ C++ C++, Java C++ C++ C++

Documenta- Very good. Good. ... Partial. [BBUV01], OK. Sparse. “Documented,Web-site Sparse doc- Very sparse.
tion OK, but but not = docu- umentation
not for completely.” mentation. extracted
beginners. documenta- from the
tion sources.
Sparse
Estimated Good for Good for Good for Perhaps for Not for be- OK OK OK Generalization
??? Difficult to
quality and quick imple- quick imple- quick imple- speeding up ginners but needed tell what
usability mentation. mentation. mentation. the WP al- OK. to allow algorithms,
Compilation Compilation Compilation gorithm? for other thresholds
possible possible possible wavelets etc are used
for fast for fast for fast than without
execution. execution. execution. Haar and a rather
Daubechies deep (and
4. unreason-
ably time-
consuming)
dive into the
source code.

Real test 1D, 2D 1D, 2D 1D (stock


signals close data
in spectral
analysis
part)
Artificial 1D 1D, 2D 1D from Generation
test signals WaveLab of sine sig-
nals and
white Gaus-
sian noise.

CWT 1D 1D Gaussian
wavelet +
first six
derivatives.

Skeleton 1D
maps
(maxima & ridges)
(I)DWT,
compactly
supported
wavelets
A comparative study of current Matlab and C++ wavelet software

Matlab cmd=Standard Matlab command •=included nD=n-dimensional GUI=graphical user interface Continued on next page. . .
5
6

Table 1 (Wavelet software comparison) – continued from previous page


Package Wavelet WaveLab Rice W.T. Wave++ MSLib WAILI ImageLib WICCK Ian Kaplan DPhil WAT Liftpack
Toolbox [DRDH+ 99] [BCF+ 02] [FKK00] [UVJ+ 02] [UVWJ99] [Woh02] [DDH97] [Kap02] [Die03] [KS01] [FPS98]
[MOPM03]
Language Matlab Matlab Matlab, C C++ C++ C++ C++ C++ C++, Java C++ C++ C++
Pyramid 1D, 2D 1D, 2D 1D, 2D (Any 1D. Or- 2D images. 2D images 1D Haar 1D & 2D 1D ON
algo- (periodic (periodized Daubechies thogonal & Symmetric with as- (Java and Daubechies
rithm, padding, or (for ON filter can be biorthogo- or periodic pect ratio only via 2–30, Sym-
zero-padding,
(bi)orthogonal wavelets) computed nal. Periodic extension. < 2 : 1. matrix let & Meyer
smooth boundary and any and aperi- Symmetric multiplica- (filter length
padding (order corrected) filter can be odic setting. extension. tions) and 32).
0 or 1) or input) Daubechies
symmetriza- 4 (C++ and
tion.) Java).
Lifting 1D, 2D. 1D 1D,
algo- biorthog-
rithm onal
Stationary 1D, 2D 1D 1D, 2D
(I)DWT
Wavelet 1D, 2D, CP 1D, 2D WP 1D WP 1D WP
& cosine only & CP
packets
(WP &
CP)
Best ba- 1D, 2D 1D, 2D 1D, WP. 1D WP
sis [CW92] Periodic and
aperiodic.
Matching 1D, 2D for For (Gaus-
pursuit WP[BCD+ 95, sian) Gabor
(MP) p. 251–272] dictionary
on interval.
Statistics Wavelet C++: stan-
density & dard es-
regression timates
analysis of linear
(1D, GUI regression
only) coefficient,
standard de-
viation, and
Lubomir T. Dechevsky, Niklas Grip, and Ewald Quak

(auto)correlation.
Matlab cmd=Standard Matlab command •=included nD=n-dimensional GUI=graphical user interface Continued on next page. . .
Table 1 (Wavelet software comparison) – continued from previous page
Package Wavelet WaveLab Rice W.T. Wave++ MSLib WAILI ImageLib WICCK Ian Kaplan DPhil WAT Liftpack
Toolbox [DRDH+ 99] [BCF+ 02] [FKK00] [UVJ+ 02] [UVWJ99] [Woh02] [DDH97] [Kap02] [Die03] [KS01] [FPS98]
[MOPM03]
Language Matlab Matlab Matlab, C C++ C++ C++ C++ C++ C++, Java C++ C++ C++
Histogram Matlab cmd Matlab cmd Matlab cmd • • • • •

Random Matlab cmd Matlab cmd Matlab cmd • •


number
genera-
tor
Thresholds 1D, 2D soft 1D S Pre- Soft or hard 1D, hard,
(varying or hard conditioning optimal “universal”
with time Global, T, (=normalize General- threshold

(T) or scale S or (for SNR). ized Cross σ 2 log N .
(S)). 1D) both. Validiation
GUI manual threshold.
(de)selection
of individual
coefficients.

1D & Global, 1D DWT Soft or hard 1D lossless Both


2D DWT level- denoising threshold compression wavelet-
and dependent under the (C++). nD based &
SWT and/or assumption similar. loss-less
compres- interval/orientation-
of white compression
sion (C) dependent Gaussian mentioned
and de- hard or (for noise of in documen-
noising D only) soft variance tation, but
(D) thresholding 1. Several only with
strategies different reference
thresholds to a broken
(soft or URL-link.
hard, global
or level-
dependent)
but fewer
than
Wavelet
Toolbox
Matlab cmd=Standard Matlab command •=included nD=n-dimensional GUI=graphical user interface Continued on next page. . .
A comparative study of current Matlab and C++ wavelet software
7
8

Table 1 (Wavelet software comparison) – continued from previous page


Package Wavelet WaveLab Rice W.T. Wave++ MSLib WAILI ImageLib WICCK Ian Kaplan DPhil WAT Liftpack
Toolbox [DRDH+ 99] [BCF+ 02] [FKK00] [UVJ+ 02] [UVWJ99] [Woh02] [DDH97] [Kap02] [Die03] [KS01] [FPS98]
[MOPM03]
Language Matlab Matlab Matlab, C C++ C++ C++ C++ C++ C++, Java C++ C++ C++
1D & 2D Global hard High-level 1D adaptive
wavelet or (for D commands denoising
packet only) soft for 1D using a
(WP) (or thresholding CP & WP library of
other or- methods denoising orthonormal
thonor- with GUI- bases for 1D
mal driven CP & WP
libraries) choice are denoising.
compres- available.
sion (C)
and de-
noising
(D)
Quantization, Shannon- Scalar and Coefficient
coding and Weaver vector quan- quanti-
bit alloca- first order tization zation,
tion (see, entropy entropy cod-
e.g. [Mal99, computation ing and bit
Chapter (bits/pixel). allocation
11] for an
overview)
Miscellane- Fast matrix Fast matrix Arbitrarily Datatypes Datatypes & Datatypes Complex Datatypes & Bandpass
ous multipli- multipli- indexed and oper- functions for & functions numbers. functions for filtering.
datatypes cation cation. 1D arrays, R3 ators for misc. opera- for misc. Coefficient misc. opera- Accompany-
and func- (example multifractal lattices, Ga- arbitrarily tions on im- operations spectrum. tions on im- ing software
tions (for application & thermo- bor function indexed ages. on images. ages. Colour library for
multiscale in manual) dynamical evaluations. coefficients, Some vector to greyscale plotting
tasks) formalism linear alge- datatypes. conversion. of scaling
bra, certain Command function,
integrals line ar- coefficents,
and plot- gument power
ting. parsing spectra or
(undocu- histogram.
mented).
Lubomir T. Dechevsky, Niklas Grip, and Ewald Quak

Matlab cmd=Standard Matlab command •=included nD=n-dimensional GUI=graphical user interface Continued on next page. . .
Table 1 (Wavelet software comparison) – continued from previous page
Package Wavelet WaveLab Rice W.T. Wave++ MSLib WAILI ImageLib WICCK Ian Kaplan DPhil WAT Liftpack
Toolbox [DRDH+ 99] [BCF+ 02] [FKK00] [UVJ+ 02] [UVWJ99] [Woh02] [DDH97] [Kap02] [Die03] [KS01] [FPS98]
[MOPM03]
Language Matlab Matlab Matlab, C C++ C++ C++ C++ C++ C++, Java C++ C++ C++
Other Time- Fast DCT. 1D Java- FFT
trans- Frequency code for
forms and Wigner- (I)DFT
Ville distri- and for
butions triangular,
Hanning and
Hamming
windows).
Input & Matlab cmd Matlab cmd Matlab cmd Load & PGM & Load &
output save, gzip VIFF for- save, .bmp
support. mat. support
Timer Matlab cmd Matlab cmd Matlab cmd • •

Command Yes. Undoc-


line ar- umented.
gument
parsing
Interpolating 1D, 2D
refine-
ments

Matlab cmd=Standard Matlab command •=included nD=n-dimensional GUI=graphical user interface


A comparative study of current Matlab and C++ wavelet software
9
10 Lubomir T. Dechevsky, Niklas Grip, and Ewald Quak

References
[BBUV01] Arne Barinka, Titus Barsch, Karsten Urban, and Jürgen Vorloeper.
The Multilevel Library — Software Tools for Multiscale Methods and
Wavelets. Version 2.2, Documentation. Institut für Geometrie und
Praktische Mathematik, RWTH Aachen, Aachen, Germany, 2001.
Available at http://www.igpm.rwth-aachen.de/urku.
[BCD+ 95] Jonathan Buckheit, Shaobing Chen, David Donoho, Iain Johnstone, and
Jeffrey Scargle. WaveLab reference manual (version 0.700). Technical
report, 1995. Available at http://www-stat.stanford.edu/∼wavelab.
[BCF+ 02] Richard Baraniuk, Hyeokho Choi, Felix Fernandes, Brent Hendricks,
Ramesh Neelamani, Vinay Ribeiro, Justin Romberg, Ramesh Gopinath,
Markus Lang, Odegard Jan Erik, and Dong Wei. Rice wavelet toolbox
(for Matlab), 2002. http://www.dsp.rice.edu/software/rwt.shtml.
[CW92] Ronald R. Coifman and Mladen Victor Wickerhauser. Entropy-based
algorithms for best basis selection. 38(2):713–718, March 1992.
[DDH97] Geoff Davis, John Danskin, and Ray Heasman. Wavelet
image compression construction kit (c++ code), 1997.
http://www.geoffdavis.net/dartmouth/wavelet/wavelet.html.
[Die03] Martin Andreas Dietze. DPhil project (C++ and Java
library for wavelet-based image manipulation), 2003.
http://herbert.the-little-red-haired-girl.org/en/research/.
[DRDH+ 99] David Donoho, Mark Reynold Duncan, Xiaoming Huo, Ofer Levi,
Jon Buckheit, Maureen Clerc, Jerome Kalifa, Stephane Mallat,
and Yu Thomas. Wavelab (a Matlab wavelet library), 1999.
http://www-stat.stanford.edu/∼wavelab.
[FKK00] S. E. Ferrando, L. A. Kolasa, and N. Kovačević.
Wave++ (C++ wavelet library), 2000.
http://www.scs.ryerson.ca/∼lkolasa/CppWavelets.html.
[FPS98] Gabriel Fernández, Senthil Periaswamy, and Wim Sweldens.
Liftpack (lifting scheme c++ implementation), 1998.
http://www.cs.dartmouth.edu/ sp/liftpack/lift.html.
[Grö00] Karlheinz Gröchenig. Foundations of Time-Frequency Analysis.
Birkhäuser, 2000. ISBN 0-8176-4022-3.
[Kap02] Ian Kaplan. Miscellaneous C++ and java
code for wavelets and signal processing, 2002.
http://www.bearcave.com/misl/misl tech/wavelets.
[KS01] Sergey Klimenko and Andrei Sazonov. Wavelet analysis tool
(C++ library), 2001. http://www.phys.ufl.edu/ligo/wavelet,
http://www.phys.ufl.edu/∼sazonov.
[Mal99] Stéphane Mallat. A wavelet tour of signal processing. Academic Press,
London, second edition, 1999. ISBN 0-12-466606-X.
[MOPM03] Michel Misiti, Georges Oppenheim, Jean-Miche Poggi, and Yves
Misiti. The Mathworks wavelet toolbox (for Matlab), 2003.
http://www.mathworks.com/products/wavelet/index.shtml.
[OS89] Alan V. Oppenheim and Ronald W. Schafer. Discrete-time signal pro-
cessing. Prentice Hall, NJ, USA, 1989. ISBN 0-13-216771-9.
[UVJ+ 02] Karsten Urban, Jürgen ’ Vorloeper, Markus Jürgens, Titus Barsch,
Arne Barinka, Birgit Gottschlich-Müller, Thomas Schlinkmann,
A comparative study of current Matlab and C++ wavelet software 11

Michael Konik, and Mario Mommer. Multiscale library (C++ library),


2002. http://www.igpm.rwth-aachen.de/urku.
[UVW99] Geert Uytterhoeven and Filip Van Wulpen. WAILI — Wavelets with
integer Lifting. Department of Computer Science, Katholieke Univer-
siteit Leuven, Celestijnenlaan 200A, B-3001 Heverlee, belgium, 1999.
Available at http://www.cs.kuleuven.ac.be/∼wavelets.
[UVWJ99] Geert Uytterhoeven, Filip Van Wulpen, and Maarten
Jansen. Waili (C++ wavelet transform library), 1999.
http://www.cs.kuleuven.ac.be/∼wavelets.
[Woh02] Brendt Wohlberg. Imagelib: An image processing C++ class library,
2002. http://www.dip.ee.uct.ac.za/∼brendt/srcdist.
Index

B N
best basis algorithm . . . . . . . . . . . . . . . . . . 6 noise reduction . . . . . . . . . . . see denoising

C
R
compression . . . . . . . . . . . . . . . . . . . . . 4, 7, 8
redundant DWT . . . . . . . . . . . . . . . . . . . . . 6
lossless . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
cosine packets . . . . . . . . . . . . . . . . . . . . . . . . 6
S
D stationary DWT . . . . . . . . . . . . . . . . . . . . . . 6
denoising . . . . . . . . . . . . . . . . . . . . . . . . . . 7, 8 SWT (discrete stationary wavelet
thresholding. . . . . . . . . . . . . . . . . . . . . . . .7 transform) . . . . . . . . . . . . . . . . . . . . . . 6
hard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
soft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 T
discrete redundant wavelet transform . 6 thresholding . . . . . . . . . . . . . . . . . . . . . . . . . . 7
discrete stationary wavelet transform . 6 hard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
discrete undecimated wavelet transform soft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6
U
G
undecimated DWT . . . . . . . . . . . . . . . . . . . 6
gzip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

M W
matching pursuit . . . . . . . . . . . . . . . . . . . . . 6 wavelet packets . . . . . . . . . . . . . . . . . . . . . . . 6

You might also like