## 3 Supporting Block Plane Extraction
### Improved RANSAC Plane Fitting Algorithm  
Among many point cloud fitting algorithms, the RANSAC algorithm is widely used. Its robustness to noise and outliers makes RANSAC a suitable choice for performing shape detection on real-world scan data. [PERSON] et al. [40] successfully used RANSAC to extract the main surface from a very dense 3D point cloud. [PERSON] et al. [41] used the advantageous properties of the RANSAC algorithm to fit planes, cylinders, spheres, and torus in point clouds. [PERSON] et al. [42] successfully extracted the roof plane of the building automatically from the airborne laser data based on the RANSAC algorithm. All the research results show that the algorithm has a good effect on the plane fitting. RANSAC judgement criterion are as follows:  
According to the basic criteria of the RANSAC algorithm, at least one set of sampling result points in the \(K\) group sampling under the confidence probability \(P\) is all valid points (inliers) [43]. \[1-\left(1-\left(1-\varepsilon\right)^{n}\right)^{K}=P \tag{8}\]  
Among them:  
\(\varepsilon\) is the sample contamination rate (roughness ratio); \(n\) is the minimum number of points required to determine the parameters of model \(M\); \(P\) is the probability of successful confidence; \(\left(1-\varepsilon\right)\) is the probability of extracting a point as the correct point; \(\left(1-\varepsilon\right)^{n}\) indicates the probability of extracting all \(n\) points as correct points, and extracts \(n\) points to determine the model parameters; \(1-\left(1-\left(1-\varepsilon\right)^{n}\right)^{K}=P\) means that, under the condition that the above formula is satisfied, the probability that the \(K\) group samples are all correct points is \(P\). However, some improvements and corrections are required in order to make the algorithm more efficient for extracting the supporting block point clouds captured by the scanner. Therefore, compared with the basic method, we propose an improved RANSAC algorithm to improve the accuracy of extraction and the processing efficiency. When the RANSAC algorithm performs plane fitting, its plane parameters are only fitted by three initial points (it takes at least three points to determine a plane). The plane fitting error of these three points may affect the fitting error judgment of all subsequent points. The farther away from the center of gravity of the three points, the larger the influence. Therefore, when the final optimal model (Best_Model_final) is selected, it is more reasonable to use the principle of least fitting error as the optimal model judgment criterion [36; 44; 45; 46]. In order to avoid the cumulative effect of the error caused by using only three points to judge plane parameters, this paper improves the conventional RANSAC algorithm. After the RANSAC iteration is completed, the plane point sets obtained by RANSAC are re-fitted with the least squares to fit the plane parameters, and finally, the best fitting plane parameters of each plane are obtained. Take the fitting of a plane as an example:  
1. The RANSAC algorithm is used to select the optimal plane. The selection condition is that the minimum plane of the plane fitting error is used, and the minimum plane of the model fitting error is taken as the optimal fitting plane to obtain the model \"Candidate_Best_Model\". 2. Based on the point of the model \"Candidate_Best_Model\", the least squares fitting method is used to solve the plane parameters of \"Best_Model_Temporary\", and the \"Best_Model_Temporary\" temporary optimal plane parameters are obtained. 3. Based on the parameters, all points in the point clouds are re-selected and judged instead of using the random sampling method. According to the rejection threshold \(t\), all the points in the point clouds whose error with the \"Best_Model_Temporary\" is less than the threshold \(t\) are included in the plane, and together with the point clouds in \(n\), the previous model constitute the new \"Best_Model_Temporary\" model;
4. Repeat steps 2 and 3 above to end.