三频外差法展开包裹相位

选取条纹周期为64、58、53,第三次外差还是一个包裹相位

clc;
close all;
clear;

%%  参数设置
width  = 1200;  
heigth = 1920;

%三频四步
fre = 3;
shift  = 4;
 
%freq为三个正弦条纹对应的周期数,λ=width/freq:代表每个条纹的周期(波长)
freq = [64 58 53];  
freq12    = 6 ;
freq23    = 5 ;  
freq123  = 1 ;
load 'resultL1.mat'%掩膜
%% 读入图像
% 利用分块矩阵C存储3组共计12张图,三种频率,四步相位
C = cell(fre,shift);  
for i=1:fre
    for j=1:shift
        C{i,j} = zeros(heigth,width);
    end
end
for i=1:fre
    for j=1:shift
        a = j-1+4*(i-1);
        C{i,j} = imread(['picture\left_RectifyDistortion_',num2str(a),'.bmp']);
    end
end
% 归一化处理
for i = 1:3
    for j = 1:4
        C{i,j} = double(C{i,j});
    end
end
%% 求解相位主值
 
% phi存储相位主值图像
phi = cell(fre,1);
for i = 1:fre
    phi{i,1} = zeros(heigth,width);
end
 
phi{1,1} = wrap_value(C{1,1},C{1,2},C{1,3},C{1,4});%64
phi{2,1} = wrap_value(C{2,1},C{2,2},C{2,3},C{2,4});%58
phi{3,1} = wrap_value(C{3,1},C{3,2},C{3,3},C{3,4});%53

PH1 = phi{1,1};   %频率64
PH2 = phi{2,1};   %频率58
PH3 = phi{3,1};   %频率53
% a = PH2(600,:);
% figure,plot(a)
% 显示
% figure,imshow(mat2gray(phase));title('64相位主值'); 
% figure,imshow(mat2gray(PH2));title('58相位主值'); 
% figure,imshow(mat2gray(PH3));title('53相位主值'); 
%% 外差
 
PH12   = zeros(heigth,width);
PH23   = zeros(heigth,width);
PH123  = zeros(heigth,width);

PH12 = PH1-PH2;
PH12(PH12<0) = PH12(PH12<0)+2*pi;
PH23 = PH2-PH3;
PH23(PH23<0) = PH23(PH23<0)+2*pi;
PH123 =  PH12-PH23;
PH123(PH123<0) = PH123(PH123<0)+2*pi;

64、58、53这是频率吧