跳至內容

Coiflet小波

維基百科,自由的百科全書
Coiflet with two vanishing moments

Coiflet小波英格麗·多貝西羅納德·科夫曼的要求所設計的一種離散小波。Coiflet小波的調整函式(scaling function)及小波函式(wavelet function)能同時擁有高消失動量,且其波形接近對稱,常被用於數位訊號處理[1]

性質

[編輯]
  • 定義
一個正交小波(orthogonal wavelet)系統若符合以下條件,則稱為Generalized Coiflet Wavelet(GOC)。
其中為小波函式,為調整函式
  • 濾波器長度與消失動量
為濾波器長度,而為系統消失動量,則最小的為:
  • 近線性相位(Near-linear phase)濾波器
夠小時,GOC的低通濾波器頻率響應擁有漸進型態(asymptotic form):
其中則為常數項。因此具有漸近線性相位(asymptotic linear phase)的特性:

應用

[編輯]
Coiflet小波除了被使用在影像壓縮外,目前也有被使用在電力系統訊號監測上[2]

係數

[編輯]
下表為coiflet小波調整函式C6~30的係數,小波函式的係數可以藉由每兩個係數變換一次符號來推導(例如C6 wavelet = {−0.022140543057, 0.102859456942, 0.544281086116, −1.205718913884, 0.477859456942, 0.102859456942})
Coiflets係數
k C6 C12 C18 C24 C30
-10 -0.0002999290456692
-9 0.0005071055047161
-8 0.0012619224228619 0.0030805734519904
-7 -0.0023044502875399 -0.0058821563280714
-6 -0.0053648373418441 -0.0103890503269406 -0.0143282246988201
-5 0.0110062534156628 0.0227249229665297 0.0331043666129858
-4 0.0231751934774337 0.0331671209583407 0.0377344771391261 0.0398380343959686
-3 -0.0586402759669371 -0.0930155289574539 -0.1149284838038540 -0.1299967565094460
-2 -0.1028594569415370 -0.0952791806220162 -0.0864415271204239 -0.0793053059248983 -0.0736051069489375
-1 0.4778594569415370 0.5460420930695330 0.5730066705472950 0.5873348100322010 0.5961918029174380
0 1.2057189138830700 1.1493647877137300 1.1225705137406600 1.1062529100791000 1.0950165427080700
1 0.5442810861169260 0.5897343873912380 0.6059671435456480 0.6143146193357710 0.6194005181568410
2 -0.1028594569415370 -0.1081712141834230 -0.1015402815097780 -0.0942254750477914 -0.0877346296564723
3 -0.0221405430584631 -0.0840529609215432 -0.1163925015231710 -0.1360762293560410 -0.1492888402656790
4 0.0334888203265590 0.0488681886423339 0.0556272739169390 0.0583893855505615
5 0.0079357672259240 0.0224584819240757 0.0354716628454062 0.0462091445541337
6 -0.0025784067122813 -0.0127392020220977 -0.0215126323101745 -0.0279425853727641
7 -0.0010190107982153 -0.0036409178311325 -0.0080020216899011 -0.0129534995030117
8 0.0015804102019152 0.0053053298270610 0.0095622335982613
9 0.0006593303475864 0.0017911878553906 0.0034387669687710
10 -0.0001003855491065 -0.0008330003901883 -0.0023498958688271
11 -0.0000489314685106 -0.0003676592334273 -0.0009016444801393
12 0.0000881604532320 0.0004268915950172
13 0.0000441656938246 0.0001984938227975
14 -0.0000046098383254 -0.0000582936877724
15 -0.0000025243583600 -0.0000300806359640
16 0.0000052336193200
17 0.0000029150058427
18 -0.0000002296399300
19 -0.0000001358212135

濾波器

[編輯]

這邊列出6, 12 ,18點的filter消失點(vanish moment)也就是k/6。

這邊的g是低頻的濾波器,h是高頻的濾波器。

可以看出,這邊採用python的語法,h會是g的反序,且n為奇數時要乘上-1

Daubechies filter

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
-0.0727 -0.3378 0.8525 -0.38486 -0.0727 0.0156
-0.0156 -0.0727 0.38486 0.8525 0.3378 -0.0727
0.0010 -0.0026 0.0079 -0.0335 0.0841 -0.1082 0.5897 -1.1494 0.5460 -0.0953 -0.0586 -0.0232
0.0232 0.0586 0.0953 0.5460 1.1494 0.5897 0.1082 0.0841 0.0335 0.0079 0.0026 0.0010
-0.003793 -0.007782 0.023452 0.065771 -0.06112 -0.40517 0.79377 -0.42848 -0.071799 0.082301 0.034555 -0.015880 -0.0090079 0.002574 -0.001117 0.000466 -0.00007098 -0.0000345
-0.0000345 -0.00007098 0.000466 0.001117 -0.002574 -0.0090079 0.015880 0.034555 -0.082301 -0.071799 0.42848 0.79377 0.40517 -0.06112 -0.065771 0.023452 0.007782 -0.003793

Matlab程式

[編輯]
F = coifwavf(W)會回傳N=str2num(W)的coiflet小波的調整函式,其中N只能為1~5的整數。[3]

Python程式

[編輯]

這邊根據上面所提供的高頻和低頻的濾波器去實作出離散小波轉換並且應用到影像壓縮上面,

透過小波轉換良好的性質,嘗試實作出連續的影像壓縮。

這邊單純是在示範小波轉換進行多次壓縮和反壓縮的結果,

如果不想轉換這麼多次修改Jmax即可。

import numpy as np
def subsampling(x, d):
    if d == 1:
        y = x[::2, :]
    elif d == 2:
        y = x[:, ::2]
    return y

def upsampling(x, d):
    s = x.shape
    if d == 1:
        y = np.zeros((p * s[0], s[1]))
        y[::2, :] = x
    elif d == 2:
        y = np.zeros((s[0], p * s[1]))
        y[:, ::2] = x
    return y
    
def cconv(x, h, d):
    if d == 2:
        return np.transpose(cconv(np.transpose(x), h, 1))
    y = np.zeros(x.shape)
    p = len(h)
    pc = int(round( float((p - 1) / 2 )))
    for i in range(0, p):
        y = y + h[i] * np.roll(x, i - pc, axis=0)
    return y
    
def DWT_compression(image, h, g): # discrete wavelet transformation
    Jmin = 0
    Jmax = log2(n)-1
    fW = image.copy()
    j = int(np.log2(image.shape[0])-1)
    A = fW[:2**(j+1):,:2**(j+1):]
    for j in arange(Jmax,Jmin-1,-1):
        A = fW[:2**(j+1):,:2**(j+1):]
        for d in arange(1,3):
            Coarse = subsampling(cconv(A,h,d),d)
            Detail = subsampling(cconv(A,g,d),d)
            A = concatenate( (Coarse, Detail), axis=d-1 )
        fW[:2**(j+1):,:2**(j+1):] = A
        j1 = Jmax-j
    return fW
    
def iDWT_decompression(image, fW, h, g): #image is original, fW is after DWT of that.
    Jmin = 0
    Jmax = int(np.log2(image.shape[0])-1)
    f1 = fW.copy()
    j = int(np.log2(image.shape[0])-1)
    A = f1[:2**(j+1):,:2**(j+1):]
    h1 = h[::-1]
    g1 = g[::-1]
    for j in arange(Jmin,Jmax+1): 
        A = f1[:2**(j+1):,:2**(j+1):]
        for d in arange(1,3):
            if d==1:
                Coarse = A[:2**j:,:]
                Detail = A[2**j:2**(j+1):,:]
            else:
                Coarse = A[:,:2**j:]
                Detail = A[:,2**j:2**(j+1):]
            Coarse = cconv(upsampling(Coarse,d),h1,d)
            Detail = cconv(upsampling(Detail,d),g1,d)
            A = Coarse + Detail
            j1 = Jmax-j
            if j1>0 and j1<5:
                imageplot(A, 'j=' + str(int(j)), [2,2,j1])
    f1[:2**(j+1):,:2**(j+1):] = A
    return f1


雙正交Coiflet小波

[編輯]
  • 定義
一個order為的雙正交Coiflet小波需符合以下條件:
  • 性質
為偶數時,會對稱於原點:。這讓雙正交coiflet在圖片壓縮方面能有較好的峰值信噪比(PSNR)。

參考資料

[編輯]
  1. ^ COIFLET-TYPE WAVELETS: THEORY, DESIGN, AND APPLICATIONS (PDF). [2016-01-25]. (原始內容 (PDF)存檔於2016-03-05). 
  2. ^ Coiflet wavelet transform applied to inspect power system disturbance-generated signals. Shyh-Jier Huang, and Cheng-Tao Hsieh. 2002. 
  3. ^ coifwavf. http://www.mathworks.com/. [22 January 2015]. (原始內容存檔於2016-05-22).