主要内容

unwrap2

Two-dimensional phase unwrapping

Since R2026a

Description

unwrapmat = unwrap2(wrapmat) returns an unwrapped two-dimensional phase matrix unwrapmat derived from the wrapmat phase matrix. The function assumes the input is wrapped in the interval [-π,π]. This syntax uses the default Goldstein algorithm which can also be specified by setting the Name-Value pair Algorithm="Goldstein".

example

unwrapmat = unwrap2(wrapmat,Algorithm=alg) specifies the unwrapping algorithm, alg, that perform the phase unwrapping by setting Algorithm=alg.

unwrapmat = unwrap2(wrapmat,Algorithm="quality",QualityMap=map) uses the quality map map. If QualityMap quality map is omitted, the function uses the negative phase derivative variance.

example

Examples

collapse all

Wrap and then unwrap a 2D image using the default Goldstein algorithm. First, create unwrapped phase data.

unwrapmat = repmat(-20*pi:pi/10:20*pi,100,1);

Then, wrap the data.

wrapmat = wrapToPi(unwrapmat);
ax = axes(figure);
imagesc(ax,wrapmat)
title(ax,"Wrapped Phase Data")
colorbar(ax)

Figure contains an axes object. The axes object with title Wrapped Phase Data contains an object of type image.

Finally, perform 2D phase unwrapping using the default Goldstein algorithm.

unwrapmat = unwrap2(wrapmat);

Plot the unwrapped data.

figure
ax = axes(figure);
imagesc(ax,unwrapmat)
title(ax,"Unwrapped Phase Data")
colorbar(ax)

Figure contains an axes object. The axes object with title Unwrapped Phase Data contains an object of type image.

First, create unwrapped phase data that includes phase noise.

unwrapmat= repmat(-20*pi:pi/10:20*pi,100,1);
unwrapmat = unwrapmat + randn(size(unwrapmat))*pi/6;

Wrap the phase data.

wrapmat = wrapToPi(unwrapmat);

Display the wrapped data.

figure(1)
ax = axes(figure(1));
imagesc(ax,wrapmat)
title(ax,"Wrapped Phase Data")
colorbar(ax)

Figure contains an axes object. The axes object with title Wrapped Phase Data contains an object of type image.

pdv = phasediffvar(wrapmat,10);
figure(2)
ax = axes(figure(2));
imagesc(ax,pdv)
title(ax,"Phase Derivative Variance")
colorbar(ax)

Figure contains an axes object. The axes object with title Phase Derivative Variance contains an object of type image.

Perform 2D phase unwrapping using the quality algorithm.

unwrapmat = unwrap2(wrapmat,Algorithm="quality",QualityMap=pdv);

Display the unwrapped data.

figure(3)
ax = axes(figure(3));
imagesc(ax,unwrapmat)
title(ax,"Unwrapped Phase Data")
colorbar(ax)

Figure contains an axes object. The axes object with title Unwrapped Phase Data contains an object of type image.

Input Arguments

collapse all

Wrapped signal, specified as a real-valued N-by-M matrix or a real-valued N-by-M-by-P MATLAB array. If wrapmat is three-dimensional, each page represents a different wrapped matrix. Pages are unwrapped separately. NaN values are ignored.

Data Types: single | double
Complex Number Support: Yes

Twp-dimensional phase unwrapping algorithm, specified as "Goldstein" or "quality". Set the unwrapping algorithm by Algorithm=alg.

  • The "Goldstein" algorithm places branch-cuts based on the location of phase residues which indicate the allowable unwrapping paths.

  • The "quality" algorithm unwraps the phase by unwrapping the highest quality pixel, and then unwrapping the highest quality neighboring pixels until no pixels remain.

Example: "Goldstein"

Data Types: char | string

Quality map for two-dimensional unwrapping, specified as a real-valued N-by-M matrix or real-valued N-by-M-by-P MATLAB array. The quality map must have the same size as the wrapmat input argument. NaN values are ignored. When the wrapmat argument is an array, the quality map must have the same size as the array. Each page of the map corresponds to a different page of the image.

If no map is specified when "quality" is selected as the algorithm, a negative phase derivative variance is used by default.

Dependencies

To enable this argument, set the Algorithm="quality".

Data Types: single | double

Output Arguments

collapse all

Two-dimensional unwrapped phase, returned as a real-valued N-by-M matrix or real-valued N-by-M-by-P MATLAB array. The size of unwrapmat matches the size of wrapmat.

Data Types: single | double

References

[1] Goldstein, Richard M., H. A. Zebker, and C. L. Werner. "Satellite Radar Interferometry: Two-dimensional Phase Unwrapping." Radio Science 23, no. 4 (1988): 713-720. https://doi.org/10.1029/RS023i004p00713.

[2] Ghiglia, Dennis C., and Mark D. Pritt. Two-Dimension Phase Unwrapping: Theory, Algorithms and Software. New York: John Wiley & Sons, 1998.

Version History

Introduced in R2026a