# Dense Robust 3D Reconstruction and Measurement for 3D Printing Process Based on Vision
## 4 Dense 3D Reconstruction of Point Clouds and Surface Texture Reconstruction in 3D Printing Process
### Sparse Point Cloud Reconstruction with Integrated SFM  
The proposed integrated SFM 3D reconstruction process of sparse point cloud is shown in Figure 5.  
Firstly, the collected images are grouped. The indicators to be considered in the grouping include the degree of overlap between images, the distribution of feature points among images, and the matching density of feature points, etc. Based on these characteristics, a correlation evaluation is proposed, and images are classified according to the correlation. The evaluation formula is as follows:  
\[s_{ij}=\alpha\frac{C(P_{i})+C\left(P_{j}\right)}{A(P_{i})+A\left(P_{j}\right)}+ \beta\frac{N\left(P_{i}\cap P_{j}\right)}{N\left(P_{i}\cup P_{j}\right)}+ \gamma\frac{V(P_{i})+V\left(P_{j}\right)}{V_{k}} \tag{10}\]  
In the formula, \(s_{ij}\) represents the correlation score of image \(P_{i}\) and \(P_{j}\), \(C\) represents the size of the graph area surrounded by the matching feature points of two images, \(A\) represents the area of the whole image, \(N\) represents the number of feature points, and \(V\) is the measure of the distribution of feature points in the image. The image is divided into \(4^{k}\) blocks of the same size by dividing the series \(k\) (\(k>0\)), and the coefficient of each level is defined as \(2^{k}\). Multiply by 1 or 0 (denoted as \(\delta\)) according to whether there are feature points in the region, then the distribution of level \(k\) is \(V=2^{k}\Sigma\delta\), and the value of \(V(*)\) is  
Figure 5: Flow chart of Integrated SFM reconstruction. \(V^{k}=\Sigma\mathcal{B}^{k}\) in total. According to the experimental results, the values of coefficients \(\alpha\), \(\beta\) and \(\gamma\) are set as 0.4, 0.4, and 0.2, respectively. Finally, the correlation between the images is used to construct the graph, and the AP clustering algorithm based on the graph is selected for grouping. The principle process is shown in Figure 6. Each image is the node of the graph, and the distance between two points is the size of correlation. The greater the correlation between two images, the closer the distance is. After the grouping is completed, the clustering center of each group is taken as the origin, and the similarity evaluation \(s_{ij}\) is used for constraint. The images with insufficient internal correlation in each cluster are filtered and removed to complete the image grouping. In the process of reconstruction in the group, the set of relative rotation matrix is obtained in the stage of feature point matching, and then the global rotation matrix of the first camera viewpoint is set as the unit matrix to get a preliminary collection of global rotation matrix. However, there are still errors between it and the set of relative rotation matrices, so it is necessary to minimize the overall error to obtain the optimal global rotation matrix set \(Rv\). The difference between the relative rotation \(R_{ij}\) and the estimated \(R_{i}{R_{i}}^{-1}\) is calculated by using the minimization loss function:  
\[Rv=\underset{\{R1,R2,\ldots,RN\}}{\text{argmin}}\sum_{(i,j)\in\varepsilon} \rho\Big{(}d\Big{(}R_{ij},R_{j}R_{i}^{-1}\Big{)}\Big{)} \tag{11}\]  
where \(\rho(\bullet)\) is the loss function and \(d(\bullet)\) is the distance between the global rotation and the relative rotation. On the basis of the research in reference [25], Equation (11) is solved by the BCH formula. In the process of selecting loss function, \(L_{1}\) and \(L_{2}\) are commonly used for testing, but the effect is not ideal. By comparison, it is found that there is not much difference in the running time of different loss functions, but \(L_{\alpha}\) has better accuracy when selecting \(\alpha=1/2\), so the loss function is:  
\[\rho(x)=2|x|^{\frac{1}{2}} \tag{12}\]  
The cost function is converged to get the global rotation matrix. Final fusion within each group, in order to prevent the large gap between the fusion results of each group, requires that the correlation evaluation and rotation error information should be combined as the constraint conditions.