mpenkov
mpenkov

Reputation: 21906

Subband decomposition using Daubechies filter

I have the following two 8-tap filters:

h0 ['-0.010597', '0.032883', '0.030841', '-0.187035', '-0.027984', '0.630881', '0.714847', '0.230378']
h1 ['-0.230378', '0.714847', '-0.630881', '-0.027984', '0.187035', '0.030841', '-0.032883', '-0.010597']

Here they are on a graph:

graph

I'm using it to obtain the approximation (lower subband of an image). This is a(m,n) in the following diagram:

diagram

I got the coefficients and diagram from the book Digital Image Processing, 3rd Edition, so I trust that they are correct. The star symbol denotes one dimensional convolution (either over rows or over columns). The down arrow denotes downsampling in one dimension (either over rows, or columns).

My problem is that the filter coefficients for h0 and h1 sum to greater than 1 (approximately 1.4 or sqrt(2) to be exact). Naturally, if I convolve any image with the filter, the image will get brighter. Indeed, here's what I get (expected result on right):

actual expected

Can somebody suggest what the problem is here? Why should it work if the convolution filter coefficients sum to greater than 1?

I have the source code, but it's quite long so I'm hoping to avoid posting it here. If it's absolutely necessary, I'll put it up later.

EDIT

What I'm doing is:

  1. Decompose into subbands
  2. Filter one of the subbands
  3. Recompose subbands into original image

Note that the point isn't just to have a displayable subband-decomposed image -- I have to be able to perfectly reconstruct the original image from the subbands as well. So if I scale the filtered image in order to compensate for my decomposition filter making the image brighter, this is what I will have to do:

  1. Decompose into subbands
  2. Apply intensity scaling to approximation subband
  3. Filter one of the subbands
  4. Apply inverse intensity scaling to approximation subband
  5. Recompose subbands into original image

Step 2 performs the scaling. This is what @Benjamin is suggesting. The problem is that then step 4 becomes necessary, or the original image will not be properly reconstructed. This longer method will work. However, the textbook explicitly says that no scaling is performed on the approximation subband. Of course, it's possible that the textbook is wrong. However, what's more possible is I'm misunderstanding something about the way this all works -- this is why I'm asking this question.

EDIT (2010/7/8)

I wrote to the author of the book for a confirmation. He said that you do have to perform the scaling, despite of what is being said in the book.

Upvotes: 2

Views: 1879

Answers (1)

Benjamin
Benjamin

Reputation: 11860

If you know the sum of the kernel, why not correct the brightness after convolution by dividing by the correct factor?

(For example you can take a 3x3 average with the kernel [1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9], but also with [2, 2, 2, 2, 2, 2, 2, 2, 2] then divide the resulting values by 18...)

EDIT: As stated in my comment, h1 sums to 0. It appears that h0 and h1 are reversed / inverse of each other, so some of the h0 coefficients may have the wrong sign.

EDIT2: Please read comments. I know this post does not answer the question, I am leaving it here for the comments.

Upvotes: 1

Related Questions