## 2 Research Methodology
### Point Cloud Contrustion and Pre-Processing
#### 2.2.1 Stereo Calibration Principle
The ray that is back-projected from \(\mathbf{p_{1}}\) by \(\mathbf{M_{1}}\) is obtained by solving:  
\[\mathbf{M_{1}}\mathbf{P}=\mathbf{p_{1}} \tag{5}\]  
The one-parameter family of solutions of Equation (5) is of the form given by:  
\[\mathbf{P}(\lambda)=\mathbf{M_{1}^{-1}}\mathbf{p_{1}}+\lambda\mathbf{C_{1}} \tag{6}\]  
where \(\mathbf{M_{1}^{-1}}\) is the pseudo-inverse of \(\mathbf{M_{1}}\), i.e., \(\mathbf{M_{1}}\mathbf{M_{1}^{-1}}=\mathbf{I}\), and \(\mathbf{C_{1}}\) is the null vector, namely the camera 1 center, defined by \(\mathbf{M_{1}}\mathbf{C_{1}}=\mathbf{0}\). The ray is parametrized by the scalar \(\lambda\). Now consider two situations: when \(\lambda=0\) and \(\lambda=\infty\), Equation (6) becomes:  
\[ \begin{array}{l}\lambda=0\ \rightarrow\ \mathbf{P}=\mathbf{M_{1}^{-1}}\mathbf{p_{1}}\\ \lambda=\infty\ \rightarrow\ \mathbf{P}=\mathbf{C_{1}}\end{array}  \tag{7}\]  
Figure 3: Schematic diagram of two cameras’ stereo calibration for dynamic workpiece modeling. These two points in the above situations can be imaged by camera 2, with projection matrix \(M_{2}\) at \(M_{2}M_{1}^{-1}\mathbf{p_{1}}\) and \(M_{2}\mathbf{C_{1}}\) respectively, in the second view. The epipolar line is the line joining these two projected points:  
\[\mathbf{l_{2}}=(M_{2}\mathbf{C_{1}})\times\left(M_{2}M_{1}^{-1}\mathbf{p_{1}}\right) \tag{8}\]  
From Equations (4) and (8), we obtain:  
\[\mathbf{F}=(M_{2}\mathbf{C_{1}})\times\left(M_{2}M_{1}^{-1}\right) \tag{9}\]  
Now that the cameras are calibrated, let us assume that the world origin is at the camera 1 center:  
\[\mathbf{M_{1}}=\mathbf{K_{1}}\big{[} \begin{array}{cc}I&\mathbf{0}\end{array} \big{]}\mathbf{M_ {2}}=\mathbf{K_{2}}\big{[} \begin{array}{cc}\mathbf{R_{12}}&\mathbf{t_{12}}\end{array}  \big{]} \tag{10}\]  
Then,  
\[\mathbf{M_{1}^{-1}}=\left[ \begin{array}{c}\mathbf{K_{1}^{-1}}\\ \mathbf{0}^{T}\end{array} \right]\mathbf{C_{1}}=\left[ \begin{array}{c}\mathbf{0}\\ 1\end{array} \right] \tag{11}\]  
Therefore, substitute \(\mathbf{M_{1}},\mathbf{M_{2}},\mathbf{M_{1}^{-1}}\), and \(\mathbf{C_{1}}\) to Equations (10) and (11), then Equation (9) becomes:  
\[\mathbf{F}=(M_{2}\mathbf{C_{1}})\times\left(M_{2}M_{1}^{-1}\right) \tag{12}\] \[=\left\{K_{2}\big{[} \begin{array}{cc}\mathbf{R_{12}}&\mathbf{t_{12}} \end{array} \big{]}\times\left[ \begin{array}{cc}\mathbf{0}\\ 1\end{array} \right]\right\}\times\left\{K_{2}\big{[} \begin{array}{cc}\mathbf{R_ {12}}&\mathbf{t_{12}}\end{array} \big{]}\times\left[ \begin{array}{c}\mathbf{K_{1}^{- 1}}\\ \mathbf{0}^{T}\end{array} \right]\right\}\] \[=(\mathbf{K_{2}}\mathbf{t_{12}})\times\left(\mathbf{K_{2}}\mathbf{R_{12}}\mathbf{K_{1} }^{-1}\right)\]  
Hence, the expression for \(\mathbf{F}=(\mathbf{K_{2}}\mathbf{t_{12}})\times\left(\mathbf{K_{2}}\mathbf{R_{12}}\mathbf{K_{1}}^{-1}\right)\) is purely in terms of \(\mathbf{K_{1}}\), \(\mathbf{K_{2}}\), \(\mathbf{R_{12}}\), and \(\mathbf{t_{12}}\). The correspondence relation between the two images is defined by the fundamental matrix, \(\mathbf{F}\), as:  
\[\mathbf{p_{2}^{T}}\mathbf{p_{1}}=0 \tag{13}\]  
Using the checkerboard to take multiple pictures and find the position in each calibration pattern, multiple sets of \(\mathbf{p_{1}}\) and \(\mathbf{p_{2}}\) will be calculated. Then, the fundamental matrix, \(\mathbf{F}\), can be solved according to Equation (13). Afterward, Equation (12) is used to find the rotation matrix, \(\mathbf{R_{12}}\), and the translation matrix, \(\mathbf{t_{12}}\), where the other parameters \(\mathbf{F}\), \(\mathbf{K_{1}}\), and \(\mathbf{K_{2}}\) are known.