how to implement integer wavelet transform (lifting wavelet transform)

620 views
Skip to first unread message

Manoj Pandey

unread,
Sep 21, 2020, 10:34:46 AM9/21/20
to PyWavelets
Hello Everyone,

I am a PhD scholar and i want to implement lifting wavelet transform using python so please send me code or guide me how to do the same

Thanks 

Manoj Pandey

unread,
Mar 10, 2021, 12:38:06 AM3/10/21
to pywav...@googlegroups.com
Dear All,

i am trying to implement LWT of an image and i got code from https://pypi.org/project/ctwavelet/ 
Codes are:

from ctwavelet import LiftingScheme
ls = LiftingScheme.LiftingScheme()
ls.apply([0,1,2,3,4,5,6,7])

coeffs = ls.get_wavelet_coeffs()
print(coeffs)

inverse_coeffs = ls.inverse(coeffs)
print(inverse_coeffs)

but while i am running this code in a Jupyter notebook it is giving the error 'LiftingScheme' object has no attribute 'get_wavelet_coeffs'
i am not able to debug this error please help me out.

Thanks in advance
Manoj Pandey
PhD Research Scholar 

--
You received this message because you are subscribed to a topic in the Google Groups "PyWavelets" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pywavelets/-qPwCZZE28Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pywavelets+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pywavelets/6b2242ca-0c36-41e2-985c-0c4e9f22ad79n%40googlegroups.com.


--





Thanks & Regards

Manoj Kumar Pandey

PhD  Research Scholar 
GGU, Bilaspur 

Alenrex Maity

unread,
Dec 2, 2022, 2:20:48 AM12/2/22
to PyWavelets
from ctwavelet import LiftingScheme
ls = LiftingScheme.LiftingScheme()
ls.apply([0,1,2,3,4,5,6,7])
coeffs = ls.get_wavelet_coefficients()

print(coeffs)
inverse_coeffs = ls.inverse(coeffs)
print(inverse_coeffs)

Liviu Vladutu

unread,
Dec 2, 2022, 2:35:38 AM12/2/22
to pywav...@googlegroups.com
Hi
Instead of that try

coeffs = ls.get_wavelet_coefficients()
print(coeffs)

and it will work. 
Rgds,

Liviu Vladutu, PhD, MSc, BSc (Honors)



You received this message because you are subscribed to the Google Groups "PyWavelets" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pywavelets+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pywavelets/7210bab2-e2fe-48d9-b9c5-7ba4a7e6d893n%40googlegroups.com.

Deepu

unread,
May 22, 2023, 2:08:44 AM5/22/23
to PyWavelets
Implementing the lifting wavelet transform using Python involves several steps. Here's a general outline of the process:

1. Import the necessary libraries:
```python
import numpy as np
```

2. Define the lifting steps:
The lifting wavelet transform consists of a series of lifting steps. Each lifting step involves prediction and update operations. Define functions to perform these operations.

```python
def predict_update(input_data):
    # Perform prediction
    predicted = input_data[1::2] - 0.5 * (input_data[::2] + input_data[2::2])
 
    # Perform update
    updated = input_data[::2] + 0.25 * (predicted[:-1] + predicted[1:])
 
    return predicted, updated
```

3. Implement the lifting wavelet transform:
Write a function that applies the lifting steps iteratively to perform the wavelet transform.

```python
def lifting_wavelet_transform(input_data, num_steps):
    # Initialize the output array
    output_data = np.copy(input_data)
 
    # Perform the specified number of lifting steps
    for _ in range(num_steps):
        predicted, updated = predict_update(output_data)
     
        # Update the output data with the predicted and updated values
        output_data[::2] = updated
        output_data[1::2] = predicted
 
    return output_data
```

4. Test the implementation:
To test the lifting wavelet transform, you can create a sample input data and apply the transform using the `lifting_wavelet_transform` function.

```python
# Create sample input data
input_data = np.array([1, 2, 3, 4, 5, 6, 7, 8])

# Specify the number of lifting steps
num_steps = 3

# Apply the lifting wavelet transform
output_data = lifting_wavelet_transform(input_data, num_steps)

print(output_data)
```

5. Customize the lifting wavelet transform:
You can modify the lifting steps, use different wavelet filters, or implement additional operations according to your specific requirements.

Please note that this is a basic implementation of the lifting wavelet transform. It assumes a 1D input data and a specific number of lifting steps. You can extend and customize the code as needed for your specific application.

I hope this provides you with a starting point for implementing the lifting wavelet transform in Python.
Reply all
Reply to author
Forward
0 new messages