Robust 2D Unwrapping Algorithm by Zixin Zhao, ported to Python.
Project description
robust_2d_unwrap
The following is an implementation of the algorithm proposed in "Robust 2D phase unwrapping algorithm based on the transport of intensity equation" (DOI:10.1088/1361-6501/aaec5c) by Zixin Zhao, Hangying Zhang, Zhaoxian Xiao, Hubing Du, Yiying Zhuang, Chen Fan and Hong Zhao.
In particular, the code is directly ported from the MatLab implementation to be python compatible.
Installation with pip
pip install robust-2d-unwrap
Basic Usage
import numpy as np
from robust_2d_unwrap import unwrap
import matplotlib.pyplot as plt
# Generate a surface, with wrapped phase for every point
h,w = 640, 480
y0, x0 = (h - 1) / 2, (w - 1) / 2
y = np.arange(h)
x = np.arange(w)
Y, X = np.meshgrid(y,x, indexing='ij')
hmap = 4 * np.exp( -( ((Y - y0)**2) / (2 * 100**2) + ((X - x0)**2) / (2 * 100**2) ))
abs_phase = hmap * 2 * np.pi
wrapped_phase = (abs_phase + np.pi) % (2 * np.pi) - np.pi
# add some noise
wrapped_phase += np.random.randn(h,w) # mu=0, std=1 rad
# visualise wrapped phase
plt.imshow(wrapped_phase) # 2d headmap
plt.title('Wrapped Phase w/ Noise')
plt.show()
# wrap phase
unwrapped_phase, _ = unwrap(wrapped_phase)
# visualize result
plt.imshow(unwrapped_phase)
plt.title('Unwrapped Phase')
plt.show()
# Noise will persist, but it will not break the unwrapping
# algorithm.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file robust_2d_unwrap-0.1.1.tar.gz.
File metadata
- Download URL: robust_2d_unwrap-0.1.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
571f6f8137f225936431f578cce0971bf83e7624a29321446e791260a77a9807
|
|
| MD5 |
b20e8af95d3704dcce46037dcc07026c
|
|
| BLAKE2b-256 |
1c51a74d8db765b889102c69d49aed204d9f75b34adc082faf34ca35602d3865
|
File details
Details for the file robust_2d_unwrap-0.1.1-py3-none-any.whl.
File metadata
- Download URL: robust_2d_unwrap-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b40f2b9a38f839207a08abba56b08ccc9ecca4898438c975dd6d696d8473cf3
|
|
| MD5 |
de12cbadb825121a14c8917700fa1714
|
|
| BLAKE2b-256 |
b74d85f69283d26c7231f4fb75db76dd7e43ba01fd9c0a5195ebd10296ef7618
|