![](http://images-20200215.ebookreading.net/23/1/1/9781482247336/9781482247336__a-computational-introduction__9781482247336__bg1c5.png)
Wavelets 435
We can continue by performing this same adding and differencing of the first four el-
ements of the result; this will involve the concatenation of two vectors of two elements
each:
s
1
= [138 + 50, 68 + 32]
= [188, 100]
d
1
= [138 − 50, 68 −32]
= [88, 36]
Replacing the first four elements of w above with this new s
1
and d
1
produces
W
2
= [188, 100, 88, 36, 4, −2, 4, −4]
which is the discrete wavelet transform at 2 scales of the original vector. We can go one
more step, replacing the first two elements of w
2
with their sum and difference:
W
3
= [188 + 100, 188 −100, 88, 36, 4, − 2, 4, −4]
= [288, 88, 88, 36, 4, −2, 4, −4]
and this is the discrete wavelet transform at 3 scales of the original vector.
To recover the original vector, we simply add and subtract, dividing by two each time;
first using only the first two elements, then the first four, and finally the lot:
288 + 88
2
,
288 −88
2
, 88, 36, 4, −2, 4, −4
= [188, 100, 88, 36, 4, −2, 4, −4]
[188, 100] + [88, 36]
2
,
[188, 100] − [88, 36]
2
, 4, −2, 4, −4
= [138, 50, 68, 32, 4, −2, 4, −4]
[138, 50, 68, 32] + [4, −2, 4, −4]
2
,
[138, 50, 68, 32] − [4, −2, 4, −4]
2
= [71, 67, 24, 26, 36, 32, 14, 18]
At each stage, the sums produce a “lower resolution” version of the original vector.
Wavelet transforms produce a mix of lower resolutions of the input, and the extra informa-
tion required for inversion.
We notice that the differences may be small if the input values are close together. This
leads to an idea for compression: we apply a threshold by setting to zero all values in the
transform that are less than a predetermined value. Suppose we take a threshold of 0, thus
removing all negative values, so that after thresholding W
3
becomes:
W
3
= [288, 88, 88, 36, 4, 0, 4, 0]
If we now use this as the starting place for our adding and subtracting, we end up with
v
= [71, 67, 25, 25, 36, 32, 16, 16].
Notice how close this is to the original vector, in spite of the loss of some information from
the transf orm.