Main Content

ls2filt

Extract wavelet filters from lifting scheme

    Description

    example

    [lod,hid,lor,hir] = ls2filt(lscheme) returns the wavelet decomposition and reconstruction filters associated with the lifting scheme lscheme.

    Note

    To extract filters from a lifting scheme created using liftwave, see ls2filt, the previous version of ls2filt.

    Examples

    collapse all

    Create a lifting scheme associated with the db4 wavelet.

    wv = 'db4';
    lsc = liftingScheme('Wavelet',wv);

    Use ls2filt to extract from the lifting scheme the corresponding wavelet filters. Compare with the filters generated by wfilters. Confirm they are equal.

    [lod,hid,lor,hir] = ls2filt(lsc);
    [lod2,hid2,lor2,hir2] = wfilters(wv);
    fprintf('Lowpass Decomposition\n ls2filt: %s\nwfilters: %s\n',num2str(lod),num2str(lod2))
    Lowpass Decomposition
     ls2filt: -0.010597    0.032883    0.030841    -0.18703   -0.027984     0.63088     0.71485     0.23038
    wfilters: -0.010597    0.032883    0.030841    -0.18703   -0.027984     0.63088     0.71485     0.23038
    
    fprintf('Highpass Decomposition\n ls2filt: %s\nwfilters: %s\n',num2str(hid),num2str(hid2))
    Highpass Decomposition
     ls2filt: -0.23038     0.71485    -0.63088   -0.027984     0.18703    0.030841   -0.032883   -0.010597
    wfilters: -0.23038     0.71485    -0.63088   -0.027984     0.18703    0.030841   -0.032883   -0.010597
    
    fprintf('Lowpass Reconstruction\n ls2filt: %s\nwfilters: %s\n',num2str(lor),num2str(lor2))
    Lowpass Reconstruction
     ls2filt: 0.23038     0.71485     0.63088   -0.027984    -0.18703    0.030841    0.032883   -0.010597
    wfilters: 0.23038     0.71485     0.63088   -0.027984    -0.18703    0.030841    0.032883   -0.010597
    
    fprintf('Highpass Reconstruction\n ls2filt: %s\nwfilters: %s\n',num2str(hir),num2str(hir2))
    Highpass Reconstruction
     ls2filt: -0.010597   -0.032883    0.030841     0.18703   -0.027984    -0.63088     0.71485    -0.23038
    wfilters: -0.010597   -0.032883    0.030841     0.18703   -0.027984    -0.63088     0.71485    -0.23038
    

    Now create a lifting scheme associated with the bior2.2 wavelet.

    wv = 'bior2.2';
    lsc = liftingScheme('Wavelet',wv);

    Use ls2filt to extract from the lifting scheme the corresponding wavelet filters. Compare with the filters generated by wfilters. Observe that wfilters includes the missing powers of the associated Laurent series as zeros so that all filters have equal even length. Except for the prepended and appended zeros, the filters coefficients generated by wfilters equal the coefficients returned by ls2filt.

    [lod,hid,lor,hir] = ls2filt(lsc);
    [lod2,hid2,lor2,hir2] = wfilters(wv);
    fprintf('Lowpass Decomposition\n ls2filt: %s\nwfilters: %s\n',num2str(lod),num2str(lod2))
    Lowpass Decomposition
     ls2filt: -0.17678     0.35355      1.0607     0.35355    -0.17678
    wfilters: 0    -0.17678     0.35355      1.0607     0.35355    -0.17678
    
    fprintf('Highpass Decomposition\n ls2filt: %s\nwfilters: %s\n',num2str(hid),num2str(hid2))
    Highpass Decomposition
     ls2filt: 0.35355    -0.70711     0.35355
    wfilters: 0     0.35355    -0.70711     0.35355           0           0
    
    fprintf('Lowpass Reconstruction\n ls2filt: %s\nwfilters: %s\n',num2str(lor),num2str(lor2))
    Lowpass Reconstruction
     ls2filt: 0.35355     0.70711     0.35355
    wfilters: 0     0.35355     0.70711     0.35355           0           0
    
    fprintf('Highpass Reconstruction\n ls2filt: %s\nwfilters: %s\n',num2str(hir),num2str(hir2))
    Highpass Reconstruction
     ls2filt: 0.17678     0.35355     -1.0607     0.35355     0.17678
    wfilters: 0     0.17678     0.35355     -1.0607     0.35355     0.17678
    

    Input Arguments

    collapse all

    Lifting scheme, specified as a liftingScheme object.

    Output Arguments

    collapse all

    Decomposition filters associated with the lifting scheme, returned as vectors. lod is the lowpass decomposition filter. hid is the highpass decomposition filter.

    Data Types: double

    Reconstruction filters associated with the lifting scheme, returned as vectors. lor is the lowpass decomposition filter. hir is the highpass decomposition filter.

    Data Types: double

    Introduced in R2021a