![](http://images-20200215.ebookreading.net/23/1/1/9781482247336/9781482247336__a-computational-introduction__9781482247336__bg1ca.png)
440 A Computational Introduction to Digital Image Processing, Second Edition
Python
In : H = array([[1,1],[1,-1]])
In : for i in range(2):
...: H = vstack([kron(H,[1,1]),kron(eye(H.shape[0]),[1,-1])])
...:
In : D = H.dot(H.T)
In : H = np.linalg.inv(np.sqrt(D)).dot(H)
In : w = (H.dot(v.T)).T
In : print np.around(w,2)
[ 101.82 31.11 44. 18. 2.83 -1.41 2.83 -2.83]
Any wavelet transform can be computed by matrix multiplications. But as we have seen in
our discussion of the DFT, this can be very inefficient. Happily many wavelet transforms can
be quickly computed by a fast algorithm similar in style to the average/difference method
we saw earlier. These methods are called lifting methods [24].
If we go back to our averaging and differencing example, we c an see that the averaging
part of the transform corresponds to low pass filtering, in that we are “coarsening” or
“blurring” our input. Similarly, the differencing part of the transform corresponds to a high
pass filter, of the sort we looked at in our discussion of edges in Chapter 9. Thus, a wavelet
transform contains within it both high and low pass filtering of our input, and we can
consider a wavelet transform entirely in terms of filters. This approach will be discussed in
Section 15.4.
Two-Dimensional Wavelets
The two-dimensional wavelet transform is separable, which means we can apply a one-
dimensional wavelet transform to an image in the same way as for the DFT: we apply a
one-dimensional DWT to all the columns, and then one-dimensional DWTs to all the rows
of the result. This is called the standard decomposition, and is illustrated in Figure 15.4.
f(x, y)
Original image
DWT of rows DWT of columns
FIGURE 15.4: The standard decomposition of the two-dimensional DWT
We can also apply a wavelet transform differently. Suppose we apply a wavelet transform
(say, using the Haar wavelet) to an image by columns and then rows, but using our transform
at 1 scale only. This will pro duce a result in four quarters: the top left will be a half-sized
version of the image; the other quarters will be high pass filtered images. These quarters will
contain horizontal, vertical, and diagonal edges of the image. We then apply a 1-scale DWT
to the top left quarter, creating smaller images, and so on. This is called the nonstandard
decomposition, and is illustrated in Figure 15.5.