热门问题
时间线
聊天
视角
Coiflet小波
来自维基百科,自由的百科全书
Remove ads
Coiflet小波是英格麗·多貝西應羅納德·科夫曼的要求所設計的一種離散小波。Coiflet小波的調整函式(scaling function)及小波函式(wavelet function)能同時擁有高消失動量,且其波形接近對稱,常被用於數位訊號處理。[1]

性質
- 定義
- 一個正交小波(orthogonal wavelet)系統若符合以下條件,則稱為Generalized Coiflet Wavelet(GOC)。
- 其中為小波函式,為調整函式
- 濾波器長度與消失動量
- 若為濾波器長度,而為系統消失動量,則最小的為:
- 近線性相位(Near-linear phase)濾波器
- 其中,則為常數項。因此具有漸近線性相位(asymptotic linear phase)的特性:
Remove ads
應用
係數
- 下表為coiflet小波調整函式C6~30的係數,小波函式的係數可以藉由每兩個係數變換一次符號來推導(例如C6 wavelet = {−0.022140543057, 0.102859456942, 0.544281086116, −1.205718913884, 0.477859456942, 0.102859456942})
Remove ads
濾波器
這邊列出6, 12 ,18點的filter消失點(vanish moment)也就是k/6。
這邊的g是低頻的濾波器,h是高頻的濾波器。
可以看出,這邊採用python的語法,h會是g的反序,且n為奇數時要乘上-1
Remove ads
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
Remove ads
雙正交Coiflet小波
- 定義
- 一個order為的雙正交Coiflet小波需符合以下條件:
- 性質
- 當為偶數時,會對稱於原點:。這讓雙正交coiflet在圖片壓縮方面能有較好的峰值信噪比(PSNR)。
Remove ads
參考資料
Wikiwand - on
Seamless Wikipedia browsing. On steroids.
Remove ads