I was recently finished the job that making the wavelet transform (2dwavelet97lift.py) appliable for any size and any aspect ratio of images. Before that, of course, I’ve spent much time for understading basics of descrete wavelet transformation. Using the sample code of CDF 9/7 Discrete Wavelet Transform which the file named “2dwavelet97lift.py”. Indeed, it is a 2D wavelet transform but only for square image and the length must be 23 while it does 3 level transform. My job is split the 2D transform into two 1D transform while its 2D transform transpose the image two times which only works on square image. This can solve the problem and be applied for any aspect ratio of images. Let’s see the result of sample image which in size of 1600x1000.
How about the other problem? In this, I use a stupid but really working way: resize it! Resize to what size? It depends on the level of transformation. We can resize the length of the image to the multiplication of (2 << level) and must larger than the original.
You can download the sample program here.
Python 2.7 and PIL are required to be installed.
Click the cmd file to run and you can also edit the parameters:
pyc_filename [image_filename] [transform_level]
沒有留言:
張貼留言