3

I'm trying to do 2d wavelet filtering in python. I found out about PyWavelets and I have been messing around with it for awhile. I am trying to do the transformation for 4 levels. When I print it out it gives werid output and I'm not sure exactly what is going on. I've tried a few things but this is the latest as an example:

test = pywt.dwt2(picture,'db1')

Any help on preforming 2d wavelets on images with PyWavelets or just in general would be much appreciated. Thank you.

Edit: The type of wavelet transformation doesn't matter

Kasarrah
  • 315
  • 2
  • 4
  • 14

1 Answers1

2

Can you explain what exactly is the weird output? you should get output vector with cA,cL,cH and cD coefficients. If you want to view the transform domain image, arrange the coefficients like below: cA, (cH, cV, cD)

length of output vector = rows x columns of the input image (provided you have a square image)

If you want to view a lower resolution image, arrange the first 1/4th elements (cA) in the output vector in square format. Currently, they will be like [Row 1, Row2, Row3...] Also, are you giving level parameter (optional) in pywt.dwt2 command?

Refer this http://www.pybytes.com/pywavelets/ref/2d-dwt-and-idwt.html

sam
  • 2,263
  • 22
  • 34
  • Please can you explain in python code what you mean by `[cA cL; cH cD]` ? – jtlz2 Sep 16 '20 at 12:18
  • 3
    cA, (cH, cV, cD) is the output.. here, cA is the approximated low-resolution image left after decomposing wavelet coefficients at that level. Others are wavelet coefficients extracted by the filter Horizontally (cH), Vertically(cV), and Diagonally(cD) – sam Sep 16 '20 at 12:49
  • 2
    Here you can see how horizontal, vertical, and diagonal image. https://pywavelets.readthedocs.io/en/latest/ – sam Sep 16 '20 at 12:51