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:
- x1 = x(A,A)
- x2 = x(A,B)
- x3 = x(B,A)
- x4 = x(B,B)
- y1 = x1(B,B)
- y2 = x2(B,A)
- y3 = x3(A,B)
- 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).