到目前为止,我已经浏览了一些引用文献,并且在 Mallat 的“信号处理小波之旅”(2008 年,表 7.1)中发现了线性样条的低通重构滤波器系数 (m=1
) 和三次样条 (m=3
)。
使用 Wasilewski 的 pywt
Python 库,我创建了几个共轭镜像滤波器用于多分辨率近似。下图说明了我对三次样条缩放函数 和小波 ψ 的结果:
生成该图的代码如下,
import numpy
import pywt
from matplotlib import pyplot as plt
class wavelet_BattleLamarie(object):
_filter_bank = None
def __init__(self, m=1):
# Sets the conjugate low pass reconstruction filter h[n] for linear
# splines (m=1) and cubic splines (m=3) as in Mallat (2008, table 7.1).
#
# REFERENCES:
# Mallat, S. A wavelet tour of signal processing: The sparse way
# Academic Press, 2008, 805.
#
if m == 1:
rec_lo = numpy.array([-0.000122686, -0.000224296, 0.000511636,
0.000923371, -0.002201945, -0.003883261, 0.009990599,
0.016974805, -0.051945337, -0.06910102, 0.39729643,
0.817645956, 0.39729643, -0.06910102, -0.051945337,
0.016974805, 0.009990599, -0.003883261, -0.002201945,
0.000923371, 0.000511636, -0.000224296, -0.000122686])
elif m == 3:
rec_lo = numpy.array([0.000146098, -0.000232304, -0.000285414,
0.000462093, 0.000559952, -0.000927187, -0.001103748,
0.00188212, 0.002186714, -0.003882426, -0.00435384,
0.008201477, 0.008685294, -0.017982291, -0.017176331,
0.042068328, 0.032080869, -0.110036987, -0.050201753,
0.433923147, 0.766130398, 0.433923147, -0.050201753,
-0.110036987, 0.032080869, 0.042068328, -0.017176331,
-0.017982291, 0.008685294, 0.008201477, -0.00435384,
-0.003882426, 0.002186714, 0.00188212, -0.001103748,
-0.000927187, 0.000559952, 0.000462093, -0.000285414,
-0.000232304, 0.000146098])
else:
raise ValueError('Order %d not implemented yet.' % (n))
# Determines the remaining conjugate mirror filters from the low pass
# reconstruction filter h[n]
dec_lo = rec_lo[::-1]
rec_hi = pywt.functions.qmf(rec_lo)
dec_hi = rec_hi[::-1]
#
self._filter_bank = (dec_lo, dec_hi, rec_lo, rec_hi)
return
@property
def filter_bank(self):
return self._filter_bank
w = pywt.Wavelet('bspline3', filter_bank=wavelet_BattleLamarie(m=3))
#w.name = 'Battle-Lamarie of order 1'
#w.short_family_name = 'B-spline'
#w.family_name = 'Battle-Lamarie'
w.orthogonal = True
w.biorthogonal = False
#w.symmetry = 'symmetric'
###############################################################################
# NICE PLOTS
###############################################################################
plt.close('all')
plt.ion()
phi, psi, x = w.wavefun()
fig = plt.figure(figsize=[8, 4])
ax = fig.add_subplot(1, 2, 1)
ax.plot(x, phi, 'k-')
ax.set_title(r'$\phi$')
bx = fig.add_subplot(1, 2, 2)
bx.plot(x, psi, 'k-')
bx.set_title(r'$\psi$')
plt.tight_layout()
但是,我仍然对以任何顺序实现 Battle-Lemarié 样条小波感兴趣,即 m={1, 2, 3, ...}。有没有更优雅的方法来创建这些小波?也许有一个较小的滤波器组?
我是一名优秀的程序员,十分优秀!