2024-09-28 21:08:06 发布
网友
我尝试用离散小波变换(DWT)分析一些数据,使用任意阶的Battle Lemarié样条小波。该分析将用于二维图像去噪,计算一阶导数和二阶导数,并从每个小波尺度提取相关信息。由于我不是数学家,我还必须确保这些小波是正交的。在
我想知道是否有人也尝试过使用这些小波族,尤其是在Python中。在
到目前为止,我查阅了一些参考文献,在Mallat的“信号处理小波之旅”(2008年,表7.1)中发现了线性样条线(m=1)和三次样条线(m=3)的低通重构滤波器系数。在
m=1
m=3
使用Wasilewski的pywtPython库,我创建了两个共轭镜像过滤器 在多分辨率近似中使用。下图说明了我对三次样条函数ψ和小波ψ的结果:
pywt
生成此图的代码如下所示:
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,…}。有没有更优雅的方法来创建这些小波?也许有一个更小的过滤器组?在
到目前为止,我查阅了一些参考文献,在Mallat的“信号处理小波之旅”(2008年,表7.1)中发现了线性样条线(
m=1
)和三次样条线(m=3
)的低通重构滤波器系数。在使用Wasilewski的
pywt
Python库,我创建了两个共轭镜像过滤器 在多分辨率近似中使用。下图说明了我对三次样条函数ψ和小波ψ的结果:生成此图的代码如下所示:
然而,我仍然对实现任意阶的Battle Lemarié样条小波感兴趣,即m={1,2,3,…}。有没有更优雅的方法来创建这些小波?也许有一个更小的过滤器组?在
相关问题 更多 >
编程相关推荐