主要内容

phasediffvar

Phase derivative of variance

Since R2026a

    Description

    var = phasediffvar(phasemat,K) returns the phase derivative variance var of a phasemat image. The variance is defined over a square window of width K. The output var enables the use of var as a quality map in the unwrap2 2D phase unwrapping function. Set the QualityMAP=var Name-value pair in the unwrap2 function.

    example

    Examples

    collapse all

    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 phase data, specified as a N-by-M real-valued matrix or N-by-M-by-P real-valued MATLAB array. M is the number of rows, N is the number of columns, and P is the number of pages. Each page contains an N-by-M real-valued matrix.

    Data Types: double

    Window width for calculating variances, specified as a positive integer.

    Example: 5

    Data Types: double

    Output Arguments

    collapse all

    Phase derivative variance, returned as N-by-M real-valued matrix or a N-by-M-by-P real-valued MATLAB array. Each pixel of var is computed from the variance of the pixels in a K-by-K neighborhood of each pixel of phase.

    Algorithms

    For each pixel located at (m,n), the phase derivative variance is defined by

    zm.n=N(Δi,jxΔ¯m,nx)2+N(Δi,jyΔ¯m,ny)2K2

    where

    • zm,n : Phase derivative variance at pixel (m,n)

    • K : Length or width (in pixels) of a rectangular window.

    • K2: Number of pixels in rectangular window.

    • Δxi.j: wrapped phase difference between the pixel values in x-direction for pixel (I,j).

    • Δ*xm,n: mean of wrapped phase difference in x-direction for window size K centered at (m,n).

    • Δyi.j: wrapped phase difference between the pixel values in y-direction for pixel (i,j).

    • Δ*ym,n: mean of wrapped phase difference in y-direction for window width K centered at (m,n).

    References

    [1] 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

    See Also

    |