## 2 Methods
### System Model  
Generally, an SL system, using grid pattern only, has two components: a camera and a projector (Figure 1). The binary grid pattern is shown in Figure 2. The value \(O_{w}\)-\(X_{w}\)\(Y_{w}\)\(Z_{w}\) is the world coordinate system, wherein the measured object is located. The value \(O_{c}\)-\(X_{c}\)\(Y_{c}\)\(Z_{c}\) is the camera coordinate system, \(O_{l}\)-\(X_{l}\)\(Y_{l}\) is the physical image coordinate system, and o-UV is the pixel coordinate system corresponding to \(O_{l}\)-\(X_{l}\)\(Y_{l}\). The projector casts the grid pattern onto the object. The camera captures the grid feature image indicating the object topography. Point \(M\) is one intersection of the grid pattern and the object surface.  
According to the pinhole model, the point \(m\) is the ideal (distortion-free) pixel point of the object point \(M\). The measuring coordinate system is usually consistent with \(O_{c}\)-\(X_{c}Y_{c}Z_{c}\). Thus, the conversion function between \(m(u,v)\) and \(M(x_{c},y_{c},z_{c})\) can be expressed as [32]:  
\[z_{c}\begin{bmatrix}u\\ v\\ 1\end{bmatrix}=\begin{bmatrix}f_{x}&0&u_{0}\\ 0&f_{y}&v_{0}\\ 0&0&1\end{bmatrix}\begin{bmatrix}\mathbf{R}_{c}^{w}&\mathbf{T}_{c}^{w}\\ \end{bmatrix}\begin{bmatrix}x_{w}\\ y_{w}\\ z_{w}\\ 1\end{bmatrix}=\begin{bmatrix}f_{x}&0&u_{0}\\ 0&f_{y}&v_{0}\\ 0&0&1\end{bmatrix}\begin{bmatrix}x_{c}\\ y_{c}\\ z_{c}\end{bmatrix} \tag{1}\]  
where (\(x_{w},y_{w},z_{w}\)) represents the coordinates of point \(M\) in \(O_{w}\)-\(X_{w}Y_{w}Z_{w}\);\(f_{x}\) and \(f_{y}\) are the camera pixel focal lengths in the horizontal ordinate direction, respectively; (\(u_{0},v_{0}\)) are the coordinates of the principal point in \(o\)-\(UV\); \(\mathbf{R}_{c}^{w}\) and \(\mathbf{T}_{c}^{w}\) represent the rotation matrix and the translational vector from \(O_{w}\)-\(X_{w}Y_{w}Z_{w}\) to \(O_{c}\)-\(X_{c}Y_{c}Z_{c}\).  
The projected grid pattern could be defined as multiple orthogonal light planes in \(O_{c}\)-\(X_{c}Y_{c}Z_{c}\). The equations of the planes are as follows [33]:  
\[\left\{\begin{aligned} \Pi_{Hi}:&\ a_{Hi}x_{c}+b_{Hi}y_{c}+c_{Hi}z_{c}+d_{Hi}=0,& (i=1,2,\dots,n)\\ \Pi_{Vj}:&\ a_{Vj}x_{c}+b_{Vj}y_{c}+c_{Vj}z_{c}+d_{Vj}=0,&(j=1,2,\dots,n) \end{aligned}\right. \tag{2}\]  
Figure 1: Schematic diagram of the SL system using grid pattern.  
Figure 2: The binary grid pattern.  
where \(\Pi_{Hi}\) is the horizontal light plane; \(\Pi_{Vj}\) is the vertical light plane; \([a_{Hi}\), \(b_{Hi}\), \(c_{Hi}\), \(d_{Hi}\)] and \([a_{Vj}\), \(b_{Vj}\), \(c_{Vj}\), \(d_{Vj}]\) represent the four coefficients of each \(\Pi_{Hi}\) and \(\Pi_{Vj}\), respectively; \(n\) is the number of the planes.  
The pinhole model and the multiple light plane constraint, \((x_{c},y_{c},z_{c})\) combined can be calculated using the following formula:  
\[\left\{\begin{array}{c}x_{c}=\frac{(u-u_{0})\cdot z_{c}}{f_{x}}\\ y_{c}=\frac{(v-v_{0})\cdot z_{c}}{f_{y}}\\ z_{c}=\frac{-d_{i}}{\frac{(u-u_{0})}{f_{x}}+b_{i}\cdot\frac{(v-v_{0})}{f_{y} }+c_{i}}\end{array}\right. \tag{3}\]  
where \([a_{i},b_{i},c_{i},d_{i}]\) is \([a_{Hi},b_{Hi},c_{Hi},d_{Hi}]\) or \([a_{Vj},b_{Vj},c_{Vj},d_{Vj}]\).  
In addition, the distortion caused by the lens is inevitable. Considering the tangential distortion and radial distortion, the relationship between the actual (distorted) pixel coordinates \((u_{d},v_{d})\) and ideal pixel coordinates \((u,v)\) of point \(m\) can be expressed as [34]:  
\[\begin{bmatrix}u_{d}\\ v_{d}\end{bmatrix}=\left(1+k_{1}r^{2}+k_{2}r^{4}\right)\begin{bmatrix}u\\ v\end{bmatrix}+\begin{bmatrix}2p_{1}uv+p_{2}\begin{pmatrix}r^{2}+2u^{2}\\ 2p_{2}uv+p_{1}\begin{pmatrix}r^{2}+2v^{2}\end{pmatrix}\end{bmatrix} \tag{4}\]  
where \(r\) is the distance between \((u,v)\) and \((u_{0},v_{0})\); \((k_{1},k_{2})\) are the radial distortion coefficients; \((p_{1},p_{2})\) are the tangential distortion coefficients.