查看“︁Coiflet小波”︁的源代码
←
Coiflet小波
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
[[File:Wavelet Coif1.svg|thumb|right|Coiflet with two vanishing moments]] '''Coiflet小波'''是[[英格麗·多貝西]]應[[羅納德·科夫曼]]的要求所設計的一種[[離散小波變換|離散小波]]。Coiflet小波的調整函式(scaling function)及小波函式(wavelet function)能同時擁有高消失動量,且其波形接近對稱,常被用於[[數位訊號處理]]。<ref>{{cite web|title=COIFLET-TYPE WAVELETS: THEORY, DESIGN, AND APPLICATIONS|url=https://seagrant.mit.edu/ESRDC_library/Wei_Dong_PhD_Thesis.pdf|access-date=2016-01-25|archive-url=https://web.archive.org/web/20160305125125/https://seagrant.mit.edu/ESRDC_library/Wei_Dong_PhD_Thesis.pdf|archive-date=2016-03-05|dead-url=yes}}</ref> == 性質 == * 定義 :一個{{Link-en|正交小波|Orthogonal_wavelet}}(orthogonal wavelet)系統若符合以下條件,則稱為Generalized Coiflet Wavelet(GOC)。 ::<math> \begin{array}{lcl} \\ \mathcal{M_\tilde{\psi}}(0,l] = 0 & \mbox{for }l\mbox{ =0,1,...,L-1} \\ \mathcal{M_\tilde{\phi}}(t_0,l] = \delta[l] & \mbox{for }l\mbox{ =0,1,...,L-1} \\ \end{array}</math> :其中<math>{\psi}</math>為小波函式,<math>{\phi}</math>為調整函式 * 濾波器長度與消失動量 :若<math>N</math>為濾波器長度,而<math>L</math>為系統消失動量,則最小的<math>N</math>為: ::<math>N=\begin{cases} 3L - 1, & \mbox{if }L\mbox{ is odd} \\ 3L, & \mbox{if }L\mbox{ is even} \\ \end{cases}</math> * 近線性相位(Near-linear phase)濾波器 :當<math>|w|</math>夠小時,GOC的[[低通濾波器]]的[[頻率響應]]擁有漸進型態(asymptotic form): ::<math>\angle{H(w)}=-t_0w+C\cdot{w^{L'}}+O(w^{L'+2})</math> :其中<math>L'=2\left \lfloor L/2 \right \rfloor+1</math>,<math>C</math>則為常數項。因此<math>h</math>具有漸近線性相位(asymptotic linear phase)的特性: ::<math>\lim_{L \to \infty}\angle{H(w)}=-t_0w</math> == 應用 == :Coiflet小波除了被使用在[[影像壓縮]]外,目前也有被使用在電力系統訊號監測上<ref>{{cite web|publisher=Shyh-Jier Huang, and Cheng-Tao Hsieh|title=Coiflet wavelet transform applied to inspect power system disturbance-generated signals|date=2002}}</ref> == 係數 == :下表為coiflet小波調整函式C6~30的係數,小波函式的係數可以藉由每兩個係數變換一次符號來推導(例如C6 wavelet = {−0.022140543057, 0.102859456942, 0.544281086116, −1.205718913884, 0.477859456942, 0.102859456942}) {| class="wikitable" border="1" style="font-size: 70%; text-align: right;" |+'''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 |---- |} == 濾波器 == <big>這邊列出6, 12 ,18點的filter消失點(vanish moment)也就是k/6。</big> <big>這邊的g是低頻的濾波器,h是高頻的濾波器。</big> <big>可以看出</big><math>h[n]=(-1)^{n}g[-n]</math><big>,這邊採用python的語法,h會是g的反序,且n為奇數時要乘上-1</big> {| class="wikitable" !Daubechies filter <math>g_k,h_k</math> !0 !1 !2 !3 !4 !5 !6 !7 !8 !9 !10 !11 !12 !13 !14 !15 !16 !17 |- !<math>h_6</math> |<nowiki>-0.0727</nowiki> |<nowiki>-0.3378</nowiki> |0.8525 |<nowiki>-0.38486</nowiki> |<nowiki>-0.0727</nowiki> |0.0156 | | | | | | | | | | | | |- !<math>g_6</math> |<nowiki>-0.0156</nowiki> |<nowiki>-0.0727</nowiki> |0.38486 |0.8525 |0.3378 |<nowiki>-0.0727</nowiki> | | | | | | | | | | | | |- !<math>h_{12}</math> |0.0010 |<nowiki>-0.0026 </nowiki> |0.0079 |<nowiki>-0.0335</nowiki> |0.0841 | -0.1082 |0.5897 | -1.1494 |0.5460 | -0.0953 |<nowiki>-0.0586</nowiki> | -0.0232 | | | | | | |- !<math>g_{12}</math> |0.0232 |0.0586 |0.0953 |0.5460 |1.1494 |0.5897 |0.1082 |0.0841 |0.0335 |0.0079 |0.0026 |0.0010 | | | | | | |- !<math>h_{18}</math> |<nowiki>-0.003793</nowiki> | -0.007782 |0.023452 |0.065771 |<nowiki>-0.06112</nowiki> |<nowiki>-0.40517</nowiki> |0.79377 |<nowiki>-0.42848</nowiki> |<nowiki>-0.071799</nowiki> |0.082301 |0.034555 |<nowiki>-0.015880</nowiki> |<nowiki>-0.0090079</nowiki> |0.002574 | -0.001117 | 0.000466 | -0.00007098 |<nowiki>-0.0000345</nowiki> |- !<math>g_{18}</math> |<nowiki>-0.0000345</nowiki> | -0.00007098 |0.000466 |0.001117 |<nowiki>-0.002574</nowiki> |<nowiki>-0.0090079</nowiki> |0.015880 |0.034555 |<nowiki>-0.082301</nowiki> |<nowiki>-0.071799</nowiki> |0.42848 |0.79377 |0.40517 |<nowiki>-0.06112</nowiki> |<nowiki>-0.065771</nowiki> |0.023452 |0.007782 |<nowiki>-0.003793</nowiki> |} == Matlab程式 == :F = coifwavf(W)會回傳N=str2num(W)的coiflet小波的調整函式,其中N只能為1~5的整數。<ref>{{cite web|title=coifwavf|url=http://www.mathworks.com/help/wavelet/ref/coifwavf.html|website=http://www.mathworks.com/|accessdate=22 January 2015|archive-date=2016-05-22|archive-url=https://web.archive.org/web/20160522130848/http://www.mathworks.com/help/wavelet/ref/coifwavf.html|dead-url=no}}</ref> == Python程式 == 這邊根據上面所提供的高頻和低頻的濾波器去實作出離散小波轉換並且應用到影像壓縮上面, 透過小波轉換良好的性質,嘗試實作出連續的影像壓縮。 這邊單純是在示範小波轉換進行多次壓縮和反壓縮的結果, 如果不想轉換這麼多次修改Jmax即可。<syntaxhighlight lang="python3"> 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 </syntaxhighlight> == 雙正交Coiflet小波 == * 定義 :一個order為<math>(L,\tilde{L})</math>的雙正交Coiflet小波需符合以下條件: ::<math> \begin{array}{lcl} \\ \mathcal{M_\tilde{\phi}}(0,l] = \delta[l] & \mbox{for }l\mbox{ =0,1,...,L-1} \\ \mathcal{M_\tilde{\psi}}(0,l] = 0 & \mbox{for }l\mbox{ =0,1,...,L-1} \\ \mathcal{M_{\phi}}(0,l] = \delta[l] & \mbox{for }l\mbox{ =0,1,...,L-1} \\ \mathcal{M_{\psi}}(0,l] = 0 & \mbox{for }l\mbox{ =0,1,...,}\tilde{L}\mbox{-1} \\ \end{array}</math> * 性質 :當<math>L</math>為偶數時,<math>h</math>會對稱於原點:<math>h[n]=h[-n]</math>。這讓雙正交coiflet在圖片壓縮方面能有較好的[[峰值信噪比]](PSNR)。 : == 参考资料 == {{Reflist}} [[Category:小波分析]]
该页面使用的模板:
Template:Cite web
(
查看源代码
)
Template:Link-en
(
查看源代码
)
Template:Reflist
(
查看源代码
)
返回
Coiflet小波
。
导航菜单
个人工具
登录
命名空间
页面
讨论
不转换
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
工具
链入页面
相关更改
页面信息