phase_unwrap.m

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 根据Ghiglia和Romero(1994)提出的方法,基于加权和非加权最小二乘法进行相位解包裹
% 链接:https://doi.org/10.1364/JOSAA.11.000107
% 输入参数:
%   * psi: 包裹的相位图,范围从-pi到pi
%   * weight: 相位的权重(可选,默认为全1)
% 输出参数:
%   * phi: 解包裹后的相位图,通过加权(或非加权)最小二乘相位解包裹得到
% 作者:Muhammad F. Kasim (University of Oxford, 2016)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function phi = phase_unwrap(psi, weight)
    if (nargin < 2) % 非加权相位解包裹
        % 计算包裹值的一阶差分,并包裹差分值
        dx = [zeros([size(psi,1),1]), wrapToPi(diff(psi, 1, 2)), zeros([size(psi,1),1])];
        dy = [zeros([1,size(psi,2)]); wrapToPi(diff(psi, 1, 1)); zeros([1,size(psi,2)])];
        rho = diff(dx, 1, 2) + diff(dy, 1, 1);
        
        % 通过求解泊松方程来得到结果
        phi
04-18 02:43