unwrap_phase
-
skimage.restoration.unwrap_phase(image, wrap_around=False, seed=None)
[source] -
Recover the original from a wrapped phase image.
From an image wrapped to lie in the interval [-pi, pi), recover the original, unwrapped image.
Parameters: image : 1D, 2D or 3D ndarray of floats, optionally a masked array
The values should be in the range [-pi, pi). If a masked array is provided, the masked entries will not be changed, and their values will not be used to guide the unwrapping of neighboring, unmasked values. Masked 1D arrays are not allowed, and will raise a
ValueError
.wrap_around : bool or sequence of bool, optional
When an element of the sequence is
True
, the unwrapping process will regard the edges along the corresponding axis of the image to be connected and use this connectivity to guide the phase unwrapping process. If only a single boolean is given, it will apply to all axes. Wrap around is not supported for 1D arrays.seed : int, optional
Unwrapping 2D or 3D images uses random initialization. This sets the seed of the PRNG to achieve deterministic behavior.
Returns: image_unwrapped : array_like, double
Unwrapped image of the same shape as the input. If the input
image
was a masked array, the mask will be preserved.Raises: ValueError
If called with a masked 1D array or called with a 1D array and
wrap_around=True
.References
[R338] Miguel Arevallilo Herraez, David R. Burton, Michael J. Lalor, and Munther A. Gdeisat, “Fast two-dimensional phase-unwrapping algorithm based on sorting by reliability following a noncontinuous path”, Journal Applied Optics, Vol. 41, No. 35 (2002) 7437, [R339] Abdul-Rahman, H., Gdeisat, M., Burton, D., & Lalor, M., “Fast three-dimensional phase-unwrapping algorithm based on sorting by reliability following a non-continuous path. In W. Osten, C. Gorecki, & E. L. Novak (Eds.), Optical Metrology (2005) 32–40, International Society for Optics and Photonics. Examples
>>> c0, c1 = np.ogrid[-1:1:128j, -1:1:128j] >>> image = 12 * np.pi * np.exp(-(c0**2 + c1**2)) >>> image_wrapped = np.angle(np.exp(1j * image)) >>> image_unwrapped = unwrap_phase(image_wrapped) >>> np.std(image_unwrapped - image) < 1e-6 # A constant offset is normal True
Please login to continue.