1
$\begingroup$

Can someone please confirm if this is indeed the correct way to compute DWT:

load image
load Haar wavelet

for i = 1: Level
  periodize edges of image
  convolve image with Low pass Haar wavelet filter and store result in G
  convolve image with Low pass Haar wavelet filter and store result in H

  convolve G with low pass Haar to calculate approximation co-eff
  convolve G with high pass Haar to calculate horizontal co-eff

  convolve H with low pass Haar to calculate vertical co-eff
  convolve H with high pass Haar to calculate diagonal co-eff

  i = i + 1
  downsample approximation by 2 
end

In case of SWT, instead of down-sampling the approximation, Haar filter co-efficients are up-sampled twice at each level and the same process is repeated. Am I correct here?

$\endgroup$
-1
$\begingroup$

In the Haar wavelet case, I just used the following NumPy:

# assume x is passed in as a variable
haar_transform = zeros(N)
i = arange(N/2, dtype=int)
haar_tranform[i]      = x[2*i] + x[2*i + 1]
haar_transform[i+N/2] = x[2*i] - x[2*i + 1]

I believe the mathematical description includes some scaling by $1/\sqrt{2}$.

I've learned that while academic papers may describe something very complicated there's a simple way to compute it.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.