某一天(2012-8-8),我在youtube打下關鍵字"old pop songs",第一個出現的影片("In The Night When We Are Together"),上面有Korean等字樣,我始終不想點進去,但是徘徊一陣子之後還是點進去了。影片開始用古典吉他做前奏,再來慢慢帶入bossa nova的和絃。其實我已經有感覺了,直到彈奏者開始唱的時候,我馬上翻出上面那首「美麗的夜裡」。我不是想要批評,就姑且當作是"In The Night When We Are Together"的「改良版」。的確,「美麗的夜裡」這首帶有力量,不過他已經不是原始的創作模型。
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.
original image
image after fwt
image after iwt
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]