# A Real-Time Automated System for Dual-Aperture Common-Path Interferometer Phase-Shifting
## 3 Real-Time Automated Phase-Difference Retrieving from a DACPI
It is worth mentioning that a commercially available piezoelectric optical translation system, which includes a driver and a coupling device, is approximately 1200% more expensive compared with our system based on a stepper motor system. Although a piezoelectric device can reach higher angular displacement resolution, our setup represents a reliable low-cost approach for real-time automatic phase recovery by phase shifting from a dual-aperture common-path interferometer. Furthermore, the integration through a widely distributed platform, such as LabView, allows standard low-cost access to users interested in the proposed system. Figure 2: Schematic of the automation system arrangement. Generally, phase-shifting techniques retrieve the object phase \(\phi(x,y)\) by solving an \(N\times 3\) system of equations from equal phase steps and specific phase-shifter calibration [32]. Particularly, generalized phase-shifting interferometry (GPSI) does not require known and equal phase steps, however a specific phase-shifter calibration is required. As recently reported, self-calibration generalized phase-shifting interferometry (SGPSI) provides the possibility of unequal and unknown phase steps without the requirement of an exhaustive calibrating process to retrieve the object phase [26,27]. In this case, SGPSI advantages allow a straight forward calculation of the phase-step \(\alpha\) introduced by linear displacement of the ruling. Digital grayscale pattern images are converted into an \(m\times n\) matrix in order to apply the SGPSI technique and obtain the phase differences \(\alpha\) between recorded interferograms using [27]:  
\[ \begin{split}\cos\frac{1}{2}\alpha_{1}&=\frac{ \text{tr}(q^{\text{T}}r)}{\sqrt{\text{tr}(q^{\text{T}}q)\text{tr}(r^{\text{T}}r)} }\\ \cos\frac{1}{2}\alpha_{2}&=\frac{\text{tr}(p^{ \text{T}}q)}{\sqrt{\text{tr}(p^{\text{T}}p)\text{tr}(q^{\text{T}}q)}}\end{split}  \tag{3}\]  
\(\text{tr}(\cdot)\) and \((\cdot)^{\text{T}}\) are the trace and transpose operators respectively; the restrictions are \(\alpha_{0}=0,\alpha_{1}\in(0,\alpha_{2})\) and \(\alpha_{2}\in(0,2\pi)\), \(p=I_{0}-I_{1}\), \(q=I_{1}-I_{2}\), and \(r=I_{0}-I_{2}\). Then, the phase of the probe arm \(\phi(x,y)\) is obtained by:  
\[\tan\phi=\frac{I_{2}-I_{1}+(I_{0}-I_{2})\cos\alpha_{1}-(I_{0}-I_{1})\cos\alpha _{2}}{(I_{0}-I_{2})\sin\alpha_{1}-(I_{0}-I_{1})\sin\alpha_{2}} \tag{4}\]  
The block diagram of the SGPSI algorithm used to obtain \(\phi(x,y)\), including the automation, is shown in Figure 4. The automation of the phase retrieving by the proposed DACPI system was incorporated into the implementation in LabView, used for the capture of the interferograms. Equation (4) retrieves the original phase function, for this purpose the SGPSI requires a minimum of 3 phase-shifted interference patterns in order to achieve the values of \(\alpha_{j}\). Each pattern is captured by a CCD camera from sequential motor steps, and then, converted into grayscale 2D \(m\times n\) arrays: \(I_{0}\), \(I_{1}\), and \(I_{2}\). The SGPSI algorithm is performed using the values of \(p\), \(q\), and \(r\), obtained from the \(I_{0}\), \(I_{1}\), and \(I_{2}\) interactions. Then,  
Figure 3: An automated DACPI system: (**a**) implementation of the system, (**b**) detail of the gear transmission system, and (**c**) the designed spur gear transmission. \(\alpha_{1}\) and \(\alpha_{2}\) are calculated (\(\alpha_{0}=0\)). Next, the phase \(\phi_{w}\) is calculated, wrapped for a period \(2\pi\) or integer multiples of \(2\pi\), which leads to a discontinuous function in the solution. In this regard, several techniques known as unwrapping phase methods are used to eliminate such discontinuities to obtain a smoothed function of the phase by adding \(2\pi\) or multiples of \(2\pi\). LabView libraries includes the virtual instrument (VI) Unwrap Phase VI, which allows 1D phase unwrapping. In order to simplify the design of the algorithm, the VI was used and adapted for the 2D unwrapping of \(\phi_{w}\). The unwrapped phase \(\phi\) is then obtained.