# How do I implement the CDF wavelet inverse?

I understand and have implemented a 2D discrete wavelet transform that uses a Haar wavelet to process images.

Now I would like to implement a 2D Cohen-Daubechies-Feauveau wavelet transform, but I am uncertain about how to do the inverse transform.

The Haar transform uses a 2x2 kernel, so I have 4 coefficients for each 2x2 block of pixels, and it's obvious to me how to reverse transform to reconstruct my pixels.

The CDF wavelet uses odd tap filters, so at each image location (i,j), I have 4 coefficients. It seems, therefore, that there is no need to downsample -- I can simply get 4 coefficient images, where each is the same size as the original image, and then run the reverse transform on those four images to reconstruct the original. Is that correct?

This is the method I tried, but it does not restore the image -- it just gives me garbage.

If A is the low pass filter and B is the high pass filter, x is the image, and x(A,B) means apply filter A to x horizontally and B to x vertically:

1. x1 = x(A,A)
2. x2 = x(A,B)
3. x3 = x(B,A)
4. x4 = x(B,B)
5. y1 = x1(B,B)
6. y2 = x2(B,A)
7. y3 = x3(A,B)
8. y4 = x4(A,A)

Sum y1, y2, y3, y4 to get original image, x.

Does this method look correct?

I am certain that I am doing the forward transform correctly, but I am unsure about the reverse transform. I have read the Wikipedia article on Fast Wavelet Transform, and I believe that I am implementing what this page states (without the downsampling).

To the contrary, the odd tap filters allow you to keep everything perfectly symmetric. If you make the filter centered at $0$, then the application of the filter at position $i$ requires a symmetric range of coefficients around $i$.
It's possible that you get a small shift with forward/backward transforms. This is especially the case if you're trying to keep your 1D filters causal (no future data needed). Anyway, Wikipedia gives you the basic form for the inverse transform: you apply the two kernels in reverse to the sand d terms & sum the two contributions. Don't mind the