N or 1, n = log
2
N.
Because matrix (2) has many zero entries, some values of the Haar spectral coecients
are equal to 0 too. Fig. 1 presents some known transforms of a test image. As transform
matrices H(n), WalshHadamard, Haar, sine and cosine matrices were used. All gures
make up the graphic representation of spectral coecients. Therefore each picture in
Fig. 1 may be interpreted as matrix, where axis row and col describe elements of matrix
S and axis value of coe. indicates values of spectral coecients in S. The test image F
is built as 8 8 matrix, which has zero values everywhere except the upper left element,
which has the value of eight.
The Fast Haar Transform has already been well known from many works [3, 4, 5,
17, 28] therefore it will not be present in details. The Haar transform is a symmetric,
M ach in e GRAP HI CS & VI S I O N vol . 13, n o. 1/2, 2004, p p .79-98
82 T he HaarWavelet Transform in Digital Im age Processing: It s Statu s and Achievem ents
separable transform that uses Haar function for its basis. It exists for N = 2
n
, where n is
an integer. The Haar function, which is an odd rectangular pulse pair, is the simplest and
oldest orthonormal wavelet [16, 17, 28]. Whereas the Fourier transform basis functions
dier only in frequency, the Haar functions vary in the both scales of width and position.
a) a = 1/
8 b) a = 1/
8
c) a = 1
d) a = 1
Fig. 1. The S transform of image containing the test impulse: a) WalshHadamard, b) Haar, c) DST
(Discrete Sine Transform), d) DCT (Discrete Cosine Transform).
From Fig. 1 we can observe that all N
2
elements of these transforms are nonzero
except the Haar transform, which has only 2N nonzero entries. These features are very
important in image processing because in many cases spectral coecients have zero
entries before next retrieval operations. This case occurs in black and white images very
often. From image data compression point of view, this case is very convenient. From
the energy distribution it can be estimated which spectral coecients can be reduced
[15, 17, 28]. It is easy to observe from Fig. 1 that the Walsh transform gives the worst
results here: distribution of spectral energy is uniformable. In c) and d) cases distribution
M ach i n e GRAP HI CS & VI S I O N vol . 13, n o. 1/2, 2004, p p .79-98
Piotr Porwik, Agnieszka L isowska 83
of spectral energy has sharply outlined maximum. Outside of the maximum value, one
can observe the decrease of energy. Unfortunately, the distribution of the Haar spectrum
(Fig. 1b) is not proper too, but we can treat this transform dierently.
The discrete transforms, presented in Fig. 1, enable us to observe where energy
concentrations occur. Hence, we know which spectral coecients are important in image
processing. From this representation, it is not possible to nd more precisely information
about real image. For example, it is dicult to point places, which describe horizontal,
vertical, etc. details of real image. These troubles can be overcome by well known
multiresolution analysis [11, 17, 20, 34, 49].
3. The Discrete Haar Wavelet Transform
An outstanding property of the Haar functions is that except function haar(0, t), the
ith Haar function can be generated by the restriction of the (j 1)th function to
be half of the interval where it is dierent from zero, by multiplication with
2 and
scaling over the interval [0, 1]. These properties give considerable interest of the Haar
function, since they closely relate them to the wavelet theory. In this setting, the rst
two Haar functions are called the global functions, while all the others are denoted
as the local functions. Hence, the Haar function, which is an odd rectangular pulse
pair, is the simplest and oldest wavelet. The motivation for using the discrete wavelet
transform is to obtain information that is more discriminating by providing a dierent
resolution at dierent parts of the timefrequency plane. The wavelet transforms allow
the partitioning of the time-frequency domain into nonuniform tiles in connection with
the timespectral contents of the signal. The wavelet methods are strongly connected
with classical basis of the Haar functions; scaling and dilation of a basic wavelet can
generate the basis Haar functions.
Def. 3.1. Let : R R, the Haar wavelet function is dened by the formula [43]:
(t) =
_
_
_
1, for t [0,
1
2
),
1, for t [
1
2
, 1),
0, otherwise.
(5)
Taking into account the Denition 3.1, any Haar function (except function haar(0, t))
from basis (2) may be generated by means of the formulas:
j
i
(t) =
2
j
(2
j
t i), i = 0, 1, . . . , 2
j
1 and j = 0, 1, . . . , log
2
N 1 . (6)
The constant
2
j
is chosen so that the scalar product <
j
i
,
j
i
>= 1,
j
i
L
2
(R). If
one considers the wavelet function on other intervals than [0, 1), the normalisation con-
stant will be dierent. For example:
0
0
= haar(1, t),
1
0
= haar(2, t),
1
1
= haar(3, t),
M ach i n e GRAP HI CS & VI S I O N vol . 13, n o. 1/ 2, 2004, p p . 79- 98
84 T he HaarWavelet Transform in Digital Im age Processing: It s Status and Achievements
2
0
= ha ar(4, t),
2
1
= haar(5, t),
2
2
= haar(6, t),
2
3
= haar(7, t). Generally
j
i
=
haar(2
j
+i, t). From this example follows that functions
j
i
(t) are orthogonal to one an-
other. Hence, we obtain linear span of vector space W
j
= span{
j
i
}
i=0,...,2
j
1
. A collec-
tion of linearly independent functions {
j
i
(t)}
i=0,...,2
j
1
spanning W
j
is called wavelets.
Def. 3.2. Let : R R, the Haar scaling function is dened by the formula [43]:
(t) =
_
1, for t [0, 1),
0, for t [0, 1).
(7)
Similarly to the properties of the wavelet function, for scaling function one can dene
the family of functions:
j
i
(t) =
2
j
(2
j
t i), i = 0, 1, . . . , 2
j
1 and j = 0, 1, . . . , log
2
N 1 . (8)
The constant
2
j
is chosen so that the scalar product <
j
i
,
j
i
>= 1,
j
i
L
2
(R). The
index j refers to dilation and index i refers to translation [11, 17]. Hence, we obtain
linear span of vector space V
j
= span{
j
i
}
i=0,...,2
j
1
. The basic functions from the
space V
j
are called scaling functions.
In multiresolution analysis the Haar basis has important property: V
j
= V
j1
W
j1
, where stands for orthogonality of V
j
and W
j
spaces [16].
From Denitions 3.1 and 3.2 follows, that vector space W
j
can be treated as the or-
thogonal complement of V
j
in V
j+1
. In other words, let W
j
be the space of all functions
in V
j+1
that are orthogonal to all functions in V
j
. Therefore, the basis functions
j
i
of
W
j
together with the basis functions
j
i
of V
j
form a basis for V
j+1
and every basis
function
j
i
of W
j
is orthogonal to every basis function
j
i
of V
j
. From the properties of
the Haar functions, described above, follows that basic wavelet is progressively narrowed
(reduced in scale) by powers of two. Each smaller wavelet is then translated by incre-
ments equal to its width, so that the complete set of wavelets at any scale completely
covers the interval. From mentioned equations one can conclude, that the basic wavelet
is scaled down by powers of 2, but its amplitude is scaled up by powers of
2.
4. The Haar and Wavelet Basic Images
Due to its low computing requirements, the Haar transform has been mainly used for
image processing and pattern recognition. From this reason two dimensional signal
processing is an area of ecient applications of Haar transforms due to their wavelet
like structure.
Because H(n) and H(n)
T
are the square matrices, their product is commutative,
therefore equations (3) and (4) can be rewritten and expressed as:
M ach i n e GRAP HI CS & VI S I O N vol . 13, n o. 1/2, 2004, p p.79-98
Piotr Porwik, Agnieszka L isowska 85
s(k, m) =
N1
x=0
N1
y=0
f(x, y) haar(k, x) haar(m, y) , (9)
f(x, y) =
N1
k=0
N1
m=0
s(k, m) haar(k, x) haar(m, y) , (10)
where S = [s
km
], F = [f
xy
], x, y, k, m {0, 1, . . . , N 1}.
Basing on equation of analysis (3) we can conclude that in 2D spectral domain the
values of coecients depend on appropriate product of the two Haar functions. Fig. 2
presents an example of multiplication the arbitrary selected Haar functions.
haar(4,x)
x
y
h
a
a
r
(
1
,
y
)
<0
>0
=0
Fig. 2. The example of multiplication of the discrete Haar functions.
Because this product is multiplied by image matrix, the result of such multiplication
may be treated as a particular extractor, which allows us to characterise the features
in real image at specied point. In other words, that product can be used to locate
the specic lines (edges) hidden in image. By looking for all coecients in the spectral
space, one can nd all important edge directions in the image. This information can
further be used in image (object) analysis [10].
Taking into account the Mallat algorithm [7, 8, 9] multiresolution image analysis
can be applied to the classical Haar basis, described by matrixequation (2). In this
case, we must nd decomposition matrices of matrix . Based on Fig. 2, construction of
decomposition matrices can be as follows:
Step 1. According to the formula V
n
= V
n1
W
n1
, the matrix M
1
has a form
M
1
= [
n1
j=0,...,2
n1
1
V
n1
,
n1
j=0,...,2
n1
1
W
n1
]
T
.
M ach i n e GRAP HI CS & VI S I O N vol . 13, n o. 1/2, 2004, p p .79-98
86 T he HaarWavelet Transform in Digital Im age Processing: It s Statu s and Achievem ents
Step 2. In second step, because V
n1
= V
n2
W
n2
W
n1
, the matrix M
2
can
be constructed as follows
M
2
= [
n2
j=0,...,2
n2
1
V
n2
,
n2
j=0,...,2
n2
1
W
n2
,
n1
j=0,...,2
n1
1
W
n1
]
T
.
. . .
Step n. Finally, after n steps of calculations V
1
= V
0
W
0
W
1
W
2
. . . W
n1
,
hence the matrix M
n
has a structure
M
n
= [
0
0
V
0
,
0
0
W
0
,
1
j=0,1
W
1
, . . . ,
n1
j=0,...,2
n1
1
W
n1
]
T
.
Exmp. 4.1. Let n = 3 then:
V
3
= V
2
W
2
M
1
= [
2
0
,
2
1
,
2
2
,
2
3
,
2
0
,
2
1
,
2
2
,
2
3
]
T
=
_
_
2 2 0 0 0 0 0 0
0 0 2 2 0 0 0 0
0 0 0 0 2 2 0 0
0 0 0 0 0 0 2 2
2 2 0 0 0 0 0 0
0 0 2 2 0 0 0 0
0 0 0 0 2 2 0 0
0 0 0 0 0 0 2 2
_
_
V
2
= V
1
W
1
W
2
M
2
= [
1
0
,
1
1
,
1
0
,
1
1
,
2
j=0,...,3
W
2
]
T
=
_
2 0 0 0 0
0 0 0 0
2 0 0 0 0
0 0 0 0
2
2 2 0 0 0 0 0 0
0 0 2 2 0 0 0 0
0 0 0 0 2 2 0 0
0 0 0 0 0 0 2 2
_
_
V
1
= V
0
W
0
W
1
W
2
M
3
= [
0
0
,
0
0
,
1
j=0,1
W
1
,
2
j=0,...,3
W
2
]
T
=
M ach i n e GRAP HI CS & VI S I O N vol . 13, n o. 1/2, 2004, p p .79-98
Piotr Porwik, Agnieszka L isowska 87
_
_
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
2 0 0 0 0
0 0 0 0
2
2 2 0 0 0 0 0 0
0 0 2 2 0 0 0 0
0 0 0 0 2 2 0 0
0 0 0 0 0 0 2 2
_
_
For last decomposition level, it can be noticed that M
n
= H(n). If each orthogonal ma-
trix M
i
, i = 1, 2, 3 will be multiplied by 1/
2(2t) + h(1)
2(2t 1) , (11)
(t) = g(0)
2(2t) + g(1)
2(2t 1) , (12)
where {h(0), h(1)} and {g(0), g(1)} dene the lowpass and highpass lters respectively.
For this case, h(k), k = 0, 1 coecients are known [5]:
h(0) =
1
2
, h(1) =
1
2
, g(0) =
1
2
, g(1) =
1
2
. (13)
Let us denote F as an image in matrix form and dene the operators
M ach i n e GRAP HI CS & VI S I O N vol . 13, n o. 1/2, 2004, p p . 79-98
Piotr Porwik, Agnieszka L isowska 89
A(i) =
1
2
F(2i) +
1
2
F(2i + 1) , (14)
D(i) =
1
2
F(2i)
1
2
F(2i + 1) , (15)
where F(i) vector of size N, containing row or column of matrix F, i {0, 1, . . . ,
N
2
1}, A(i) vector of size N/2, containing approximation coecients, D(i) vector of
size N/2, containing detail coecients.
To get nonstandard wavelet decomposition on the rst level of an image F (the
spectrum matrix called S
1
) we rst apply the operators (14), (15) to all columns of the
matrix and then to all rows [16]. To get the second level of nonstandard decomposition
(that is matrix S
2
) one can apply similar analysis to upper left submatrix of size
N
2
N
2
of matrix S
1
. And generally, to get kth level matrix S
k
, one can apply this analysis
to upper left submatrix of size
N
2
k1
N
2
k1
of matrix S
k1
, where k {1, . . . , log
2
N}.
Note, that applying lters (14), (15) to an image, give the same results as multiplying
matrices S
1
=
1
8
M
1
F M
T
1
, where matrix M
1
is taken from Ex. 4.1. Therefore, S
1
may be treated as extractor of image features on the rst level of wavelet decomposition,
similar as above in Haar decomposition case. Because on the second and next levels only
the part of a matrix is transformed (opposite to Haar decomposition) these extractors
on these levels are dierent. For example, for N = 8 the products of the nonstandard
wavelet decomposition levels are shown in Fig. 4.
Fig. 4. The 2D wavelet functions product treated as extractors. Decomposition levels: (left) rst,
(center) second, (right)third.
All considerations, which have been presented until now for the classical of Haar
functions, have applications in that case too, with the exception of extractors distribution
(Fig. 4). Additionally, it is common knowledge that coecients h(k), k = 0, 1 (in other
M ach in e GRAP HI CS & VI S I O N vol . 13, n o. 1/2, 2004, p p .79-98
90 T he HaarWavelet Transform in Digital Im age Processing: It s Statu s and Achievem ents
wo r ds s o ca lled lter s ) may b e des cr ib ed by mea ns o f s ca la r pr o duct o f functio ns a nd
respectively:
h(k) =< (t),
n1
i=0
2
i
2
i
. Hence, after simple calculations we get the following corollary.
Corollary 5.1. The number of proportional coecients in Haar and wavelet matri-
ces of size 2
n
2
n
equals
n1
i=0
2
i
2
i
2
n
2
n
1
3
. (19)
It means that as much as 1/3 of all Haar matrix coecients are proportional to wavelet
matrix coecients; for all of them the formula (18) is true.
6. Concluding Remarks
Wavelets analysis is a particular timespace scale representation of signals, which has
found a wide range of applications in physics, signal processing and applied mathematics
in the last years. The purpose of this paper was to compare the wavelets and the Haar
functions in twodimensional space. In many cases, these methods are similar. Presented
in this paper the Haar matrixbased method and wavelet analysis can be used in many
areas of image processing such as denoising, edge detection, edge preserving smoothing
or ltering. In the paper is shown the graphic way of presentation of decomposition levels
for both the Haar matrixbased method and wavelets. As it was shown both methods
may be modelled on the basis of the wavelets theorem.
The 2D Haar matrix method of calculations like the 2D Fast Fourier Transform has
complexity O(4N
2
log
2
N) [14], classical 2 1D fast nonstandard wavelet method of
calculations has complexity O(16/3N
2
) only [28]. This complexity can be decreased to
O(14/3N
2
) by suitable organization of calculations [49]. Described complexity factors
are determined as number of additions and multiplications in computation process. The
graphic distribution of the Haarwavelet spectral coecients also was presented. Ad-
ditionally, graphic presentation of spectra distribution allows us to point appropriate
M ach i n e GRAP HI CS & VI S I O N vol . 13, n o. 1/2, 2004, p p.79-98
Piotr Porwik, Agnieszka L isowska 95
selection or modication (reduction) of the Haarwavelet coecients. For example it
may be removed vertical, horizontal or diagonal details of a given image.
The authors believe that this survey and problem description can be useful to re-
searchers working in dierent disciplines where the discrete Haar and wavelets transforms
are used.
References
1910
[1] Haar A.: Zur Theorie der orthogonalen Funktionensysteme. Mathematische Annalen, 69, 331371.
1973
[2] Rudin W.: Functional Analysis. McGrawHill, New York.
1975
[3] Ahmed N., Rao K.R.: Orthogonal Transforms for Digital Signal Processing. SpringerVerlag, Berlin.
1977
[4] Harmuth H.F.: Sequency Theory. Foundations and applications. Academic Press, New York.
1978
[5] Pratt W. K.: Digital Image Processing. John Wiley and Sons, New York.
1988
[6] Besslich P. W., Trachtenberg L. A.: The sign transform an invertible nonlinear transform with quan-
tized coecients. In: Moraga C., editor, Theory and application of spectral techniques, University
Dortmund Press.
[7] Jain A.K.: Fundamentals of Digital Image Processing. Prentice Hall.
1989
[8] Mallat S.: Multifrequency channel decompositions of images and wavelet models. IEEE Transaction
in Acoustic Speech and Signal Processing, 37, 20912110.
[9] Mallat S. A.: Theory for Multiresolution Signal Decomposition: The Wavelet Representation. IEEE
Transactions on Pattern Analysis and Machine Intelligence, 11(7), 674693.
[10] Yankowitz D., Bruckstein A.M.: A New Method for Image Segmentation. Computer Vision, Graphics
and Image Processing, 46/1, 8295.
1992
[11] Daubechies I.: Ten lectures on wavelets. Philadelphia PA, SIAM.
[12] Grochenig K., Madych W. R.: Multiresolution Analysis, Haar bases and selfsimilar tilings of R
n
.
IEEE Transactions on Information Theory, 38(2), 556568.
1994
[13] Odegard J.: Image Enhancement by Nonlinear Wavelet Processing. Rice University CML Technical
Report.
1995
[14] Bhaskaran V., Konstantinides K.: Image and video compression standards: algorithms and archi-
tectures. Kluwer, Boston.
[15] Stollniz E. J., DeRose T. D., Salesin D. H.: Wavelets for Computer Graphics: A Primer, Part 1.
IEEE Computer Graphics and Applications, 7684.
[16] Fournier A.: Wavelets and their Applications in Computer Graphics. SIGGRAPH95 Course Notes,
University of British Columbia.
1996
[17] Castleman K. R.: Digital Image Processing. PrenticeHall, New Jersey.
1997
[18] Calderbank A. R., Daubechies I., Sweldens W., Yeo B. L.: Lossless image compression using integer
to integer wavelet transforms. Proceedings of the International Conference on Image Processing, 1,
596599.
[19] Claypoole R., Davis G., Sweldens W., Baraniuk R.: Adaptive Wavelet Transforms for Image Coding.
Asilomar Conference on Signals, Systems and Computers.
M ach in e GRAP HI CS & VI S I O N vol . 13, n o. 1/2, 2004, p p .79-98
96 T he HaarWavelet Transform in Digital Im age Processing: It s Statu s and Achievem ents
[20] Creusere C. D.: A new method of robust image compression based on the embedded zerotree wavelet
algorithm. IEEE Transactions on Image Processing, 6, 14361442.
[21] Przelaskowski A., Kazubek M., Jamrogiewicz T.: Optimalization of the WaveletBased Algorithm
for Increasing the Medical Image Compression Eciency. Proceedings of the TFTS97 2nd IEEE
UK Symposium on Applications of TimeFrequency and TimeScale Methods, 177-180.
[22] Walker J. S.: Fourier Analysis and Wavelet Analysis. Notices of the American Mathematical Society,
44(6), 658670.
[23] Wojtaszczyk P.: A Mathematical Introduction to Wavelets. Cambridge University Press, Cambridge.
1998
[24] Calderbank A. R., Daubechies I., Sweldens W., Yeo B. L.: Wavelet transforms that map integers to
integers. Applied and Computational Harmonics Analysis, 5(3), 332369.
[25] Daubechies I.: Recent results in wavelet applications. Journal of Electronic Imaging, 7(4), 719724.
[26] Daubechies L., Sweldens W.: Factoring wavelet transforms into lifting steps. J. Fourier Anal. Appl.,
4(3), 247269.
[27] Davis G., Nosratinia A.: WaveletBased Image Coding: An Overview. Applied and Computational
Control, Signals, and Circuits, 1(1).
[28] Sonka M., Hlavac V., Boyle R.: Image processing, Analysis and Machine Vision. Brooks/Cole Pub-
lishing Comp.
1999
[29] Davis G., Strela V., Turcajova R.; Multivwavelet Construction via the Lifting Scheme. Wavelet
Analysis and Multiresolution Methods, T. X. He (editor), Lecture Notes in Pure and Applied Math-
ematics, Marcel Dekker.
[30] Smith S. W.: The Scientist and Engineers Guide to Digital Signal Processing. California Technical
Publishing, San Diego.
2000
[31] Christopoulos C., Skodras A., Ebrahimi T.: The JPEG2000 Still Image Coding System: an Overview.
IEEE Transactions on Consumer Electronics, 46(4), 11031127.
[32] Fernandes F., van Spaendonck R., Burrus C.: Directional ComplexWavelet Processing. Wavelet
Applications in Signal and Image Processing.
[33] Jahromi O. S., Francis B. A., Kwong R. H.: Algebraic theory of optimal lterbanks. Proceedings of
IEEE International Conference on Acoustics, Speech and Signal Processing, 1, 113116.
[34] Romberg J., Choi H., Baraniuk R., Kingsbury N.: Multiscale Classication using Complex Wavelets.
IEEE International Conference on Image Processing, Vancouver, Canada.
2002
[35] Addison P. S., Watson J. N., Feng T.: LowOscillation Complex Wavelets. Journal of Sound and
Vibration, 254(4), 733762.
[36] Blu T., Unser M.: Wavelets, Fractals and Radial Basis Functions, IEEE Transactions on Signal
Processing, 50(3), 543553.
[37] Munoz A., Ertle R., Unser M.: Continuous wavelet transform with arbitrary scales and O(N) com-
plexity. Signal Processing, 82, 749757.
[38] Resniko H., Wells R. O. Jr.: Wavelet Analysis. SpringerVerlag, New York.
[39] Zeng L., Jansen C. P., Marsch S., Unser M., Hunziker R.: FourDimensional Wavelet Compression of
Arbitrarily Sized Echocardiographic Data. IEEE Transactions on Medical Imaging, 21(9), 11791188.
2003
[40] Drori I., Lischinski D.: Fast Multiresolution Image Operations in the Wavelet Domain. IEEE Trans-
actions on Visualization and Computer Graphics, 9(3), 395411.
[41] Fernandes F., Selesnick I., van Spaendonck R., Burrus C.: Complex Wavelet Transforms with Allpass
Filters. Signal Processing, 83(8), 16891706.
[42] Jorgensen P.: Matrix Factorizations, Algorithms, Wavelets. Notices of the American Mathematical
Society, 50(8), 880894.
[43] Jahromi O. S., Francis B. A., Kwong R. H.: Algebraic theory of optimal lterbanks. IEEE Transac-
tions on Signal Processing, 51, 442457.
[44] Lisowska A.: Nonlinear Weighted Median Filters in Dyadic Decomposition of Images. Annales UMCS
Informatica AI, 1, 157164.
[45] Prieto M. S., Allen A. R.: A Similarity Metric for Edge Images. IEEE Transactions on Pattern
Analysis and Machine Intelligence, 25(10), 12651273.
M ach in e GRAP HI CS & VI S I O N vol . 13, n o. 1/2, 2004, p p .79-98
Piotr Porwik, Agnieszka L isowska 97
[46] Romberg J., Wakin M., Baraniuk R.: Multiscale Geometric Image Processing. SPIE Visual Com-
munications and Image Processing, Lugano, Switzerland.
[47] Yitzhaky Y., Peli E.: A Method for Objective Edge Detection Evaluation and Detector Parameter
Selection. IEEE Transactions on Pattern Analysis and Machine Intelligence, 25(8), 10271033.
[48] Zhang J. K., Davidson T. N., Wong K. M.: Ecient design of orthonormal wavelet bases for signal
representation. IEEE Transactions on Signal Processing.
2004
[49] Lisowska A., Porwik P.: New Extended Wavelet Method of 2D Signal Decomposition Based on Haar
Transform. Mathematics and Computers in Simulation, Elsevier Journal, (to appear).
[50] Porwik P., Lisowska A.: The New Graphic Description of the Haar Wavelet Transform. Lecture
Notes in Computer Science, SpringerVerlag, Berlin, Heidelberg, New York, 3039, 18.
M ach in e GRAP HI CS & VI S I O N vol . 13, n o. 1/2, 2004, p p.79-98 .