1

我正在尝试使用任意阶的 Battle-Lemarié 样条小波通过离散小波变换 (DWT) 分析一些数据。该分析将用于二维图像去噪,计算一阶和二阶导数,并从每个小波尺度中提取相关信息。由于我不是数学家,我还必须确保这些小波是正交的。

我想知道是否有人也尝试过使用这些小波系列,尤其是在 Python 中。

4

1 回答 1

1

到目前为止,我查看了一些参考资料,并在 Mallat 的“信号处理小波之旅”(2008 年,表 7.1)中找到了线性样条 ( m=1) 和三次样条 ( ) 的低通重建滤波器系数m=3

使用 Wasilewski 的pywtPython 库,我创建了几个用于多分辨率近似的共轭镜像过滤器。下图说明了我对三次样条缩放函数 φ 和小波 ψ 的结果:

缩放函数 φ 和小波 ψ

生成此图的代码如下,

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, ...}。有没有更优雅的方法来创建这些小波?也许一个过滤器组更小?

于 2013-09-18T04:36:12.513 回答