%Purpose: reconstruct the object wave from the phase-shifting interferograms;
%Inputs: %'I1', 'I2', 'I3', Phase-shifting holograms;
        %'ph1', 'ph2'; Phase shifts between the three phase-shifting holograms
%Outputs: %'Re_O', reconstructed object wave; 
function [Comp_O]=Three_Step_PSI_Reconstruction(I1,I2,I3,ph1,ph2)
    Q1=I1-I3; Q2=I2-I3;          
    Numerator=Q1.*( exp(-j*ph1)-exp(-j*ph2))-Q2.*(1-exp(-j*ph2)); %Numerator of 'OR*'; 
    Denominator=2*1i*(sin(ph2)-sin(ph1)+sin(ph1-ph2)); %Denominator 
Comp_O=Numerator./Denominator;  %Reconstructed 'OR*'; 
end
%Reference: OPTICS LETTERS,34(22),3553-3555; 
