CWO++library  0.32
 All Classes Functions Variables Groups
Phase shifting digital holography

This code calculates 4-steps phase shifting digital holography.

CWO c1,c2,c3,c4;
c1.Load("lena1024.bmp","mandrill1024.bmp"); //Amp=lena, Arg=mandrill
c1.Diffract(0.1);
c1.ScaleCplx();
c2=c1;
c3=c1;
c4=c1;
//generating inline hologram 1
c1+=c1.Polar(1.0f, 0.0f); //add reference light with no phase shift
c1.Intensity();
//generating inline hologram 2
c2+=c2.Polar(1.0f, CWO_PI/2);//add reference light with phase shift of pi/2
c2.Intensity();
//generating inline hologram 3
c3+=c3.Polar(1.0f, CWO_PI);//add reference light with phase shift of pi
c3.Intensity();
//generating inline hologram 4
c4+=c4.Polar(1.0f, 3.0f/2.0f*CWO_PI);//add reference light with phase shift of 3pi/2
c4.Intensity();
//retrieve object wave on the inline holograms using 4-steps phase shifting digital holography
c1-=c3;
c2-=c4;
c3.Clear();
c3.ReIm(c1,c2);//The real and imaginary parts of c3 are replaced by the real parts of c1 and c2, respectively
//reconstruction
c3.Diffract(-0.1);
c3.SaveAsImage("phase_shift_lena.jpg",CWO_SAVE_AS_AMP);
c3.SaveAsImage("phase_shift_mandrill.jpg",CWO_SAVE_AS_ARG);

shifting digital holography