# A Binocular Vision-Based 3D Sampling Moire Method for Complex Shape Measurement
## 2 Principles
### Phase Correction  
When using sampling moire for 3D projection fringe measurement, a single camera is often used to capture the fringe image. The 3D shape of the object causes the fringe image to deform. The phase distribution of the fringe images before and after deformation are denoted by \(\phi_{S}\) and \(\phi_{S}{{}^{\prime}}\). The phase distribution of sampling moire before and after deformation are denoted by \(\phi_{m}\) and \(\phi_{m}{{}^{\prime}}\). The displacement field of the fringe deformation can be expressed by Equation (7) [17]:  
\[ \begin{array}{l}u=\frac{P_{S}(\phi_{S}-\phi_{S}{{}^{\prime}})}{2\pi}=\frac{P_ {S}(\phi_{m}-\phi_{m}{{}^{\prime}})}{2\pi}\\ \phi_{S}=\frac{2\pi\pi}{P_{S}}+\phi_{0},\ \phi_{S}{{}^{\prime}}=\frac{2\pi(\pi+u)} {P_{S}}+\phi_{0}\end{array}  \tag{7}\]  
From a fixed viewing angle, the fringe images before and after deformation have the same original fringe pitch \(P_{S}\) and initial phase \(\phi_{0}\), which are eliminated during the process of displacement calculation by phase subtraction. This ensures that the phase difference of the sampled moire is equal to the one of the fringe. However, in binocular vision, the spatial position and visual angle of the left and right cameras are not the same. As a result, there is a difference of initial phase between the left and right fringe images (\(\phi_{0L}\
eq\phi_{0R}\)). Moreover, the fringe pitch of the left and right images will also be different (\(P_{SL}\
eq P_{S}\)). Therefore, it is difficult to directly use Equation (7) to calculate the binocular disparity between the left and right cameras by sampled moire. Herein, we propose a phase correction and phase matching algorithm, and its process is shown in Figure 3. First, the [PERSON]'s calibration method [23] is used to calibrate the internal and external parameter matrices of the left and right cameras. Then, [PERSON]'s algorithm [27] is used for epipolar rectification. The optical axes of the left and right cameras after correction are parallel, so that the two points (Point \(A_{L}{{}^{\prime}}\) and Point \(A_{R}{{}^{\prime}}\)) of the same object point (Point \(A\)) have the same y-coordinate. This step eliminates the parallax between the two cameras in the \(Y\) direction. In addition, after correction, there is a simple relationship [27] between the distance from Point \(A\) to the baseline (depth \(z_{W}\)) and the distance between Point \(A_{L}{{}^{\prime}}\) and Point \(A_{R}{{}^{\prime}}\) (\(|A_{L}{{}^{\prime}}A_{R}{{}^{\prime}}|\)). As shown in Equation (8), the depth can be calculated according to the proportional relationship, so that the calculation speed is higher than when using Equation (6). \[z_{w}=\frac{f_{\rm C}|O_{L}O_{R}|}{|A_{L}{{}^{\prime}}A_{R}{{}^{\prime}}|} \tag{8}\]  
Figure 2: The binocular vision mode. where \(f_{\rm C}\) represents the corrected focal length; \(|O_{\rm L}O_{\rm R}|\) is the spatial distance between the optical center of the left and right cameras; and \(|A_{L}{{}^{\prime}}A_{R}{{}^{\prime}}|\) is the pixel distance between image points. For the fringe images after epipolar rectification, the wrapping phase (\(\phi_{w}\)) of the sampled moire can be obtained. Because the left and right images have different initial phases \(\phi_{0}\), the phase of sampling moire needs to be corrected. The specific process is shown in Equation (9). The sampled moire phase (\(\phi_{m}\)) is obtained after wrapped phase unwrapping, while the phase distribution \(\phi_{g}\) of the fringe images is revealed after adding the sampling phase (\(\phi_{S}=2\pi x/P_{S}\)). Finally, selecting any object as point \(A\), the fringe phase of the image point (\(A_{L}{{}^{\prime}}\) and \(A_{R}{{}^{\prime}}\)) is subtracted from the fringe phase of corresponding images, and the phase correction is completed. The corrected fringe phase causes the same object point to have the same phase value in the left and right images. \[