# Multi-Scale Indoor Scene Geometry Modeling Algorithm Based on Segmentation Results
## 3 Methods
### Determining the Type of Planar or Curved Surface
#### 3.1.2 Feature Calculation Based on Covariance Matrix  
To construct the covariance matrix using the points within the centroid and its search neighborhood, the eigenvalues \(\lambda_{1}>\lambda_{2}>\lambda_{3}\geqslant 0\) of the covariance matrix are calculated through principal component analysis. Based on the different quantity relationships between the eigenvalues, the corresponding dimensional features can be derived. The specific calculation formula is as follows:  
\[\begin{split} L_{\lambda}&=\frac{\sqrt{\lambda_{1} }-\sqrt{\lambda_{2}}}{\sqrt{\lambda_{1}}}\\ P_{\lambda}&=\frac{\sqrt{\lambda_{2}}-\sqrt{ \lambda_{3}}}{\sqrt{\lambda_{1}}}\\ S_{\lambda}&=\frac{\sqrt{\lambda_{3}}}{\sqrt{ \lambda_{1}}},\end{split} \tag{1}\]  
where \(L_{\lambda}\) represents the one-dimensional linear degree, \(P_{\lambda}\) represents the two-dimensional planar degree, and \(S_{\lambda}\) represents the three-dimensional scattering degree, satisfying \(L_{\lambda}+P_{\lambda}+S_{\lambda}=1\). \(P_{\lambda}\) can be used to estimate the similarity between the local shape of the face and a plane. A higher value indicates a smoother face, thus, it can be used to distinguish between planes and curved surfaces [17].  
Figure 2: Multi-scale search neighborhood plane schematic diagram.  
For curved surfaces, taking a sphere as an example, the degree of curvature of the sphere varies with different radius values. A sphere with a larger radius corresponds to a smaller curvature, indicating that the local shape is closer to a plane. The calculation formula for estimating surface curvature using eigenvalues is as follows:  
\[C_{\lambda}=\frac{\sqrt{\lambda_{3}}}{\sqrt{\lambda_{1}+\sqrt{\lambda_{2}}+ \sqrt{\lambda_{3}}}}. \tag{2}\]  
When the \(C_{\lambda}\) value is larger, it indicates that the shape of the face is more curved. In order to achieve a more uniform expression, the curvature of the local shape is defined based on \(C_{\lambda}\) as follows:  
\[b=(1-C_{\lambda})^{2}. \tag{3}\]  
When the value of \(b\) is larger, the current face is closer to being a plane. The probability of the current face belonging to a plane or curved surface is described by combining the planarity \(P_{\lambda}\) and curvature \(b\). The calculation formula is as follows:  
\[cf=P_{\lambda}\times b. \tag{4}\]  
For a face, the corresponding \(cf\) values are calculated based on the points within the spherical neighborhood at different scales as discussed in the previous section, and then they are fused using a weighted approach. The weighted formula is as follows:  
\[CF=\sum_{i=1}^{3}w_{i}\cdot cf_{i}, \tag{5}\]  
where \(cf_{i}\) represents the calculation results at different scales and \(w_{i}\) represents the corresponding weight values. The results of the spherical neighborhood calculation at three scales are weighted using the average noise of the point cloud. The definition formula for \(w_{i}\) is as follows:  
\[\left\{\begin{array}{l}w_{1}=e^{-t}\\ w_{2}=1-e^{-t}\\ w_{3}=2\big{(}1-e^{-t}\big{)}.\end{array}\right. \tag{6}\]  
Among them, \(t\) represents the average noise amplitude of the point cloud, which is generally set based on the average density of the point cloud. In the case of high point cloud noise, the value of \(w_{3}\) is larger, which can balance the final value obtained by the larger radius. Conversely, when the point cloud noise is low, the value of \(w_{1}\) is larger, which can use more locally stable features to ensure the accuracy of the results. For a given threshold \(CF_{\text{th}}\) for judging planar and curved surfaces, when \(CF>CF_{\text{th}}\), it indicates that the current face is classified as a plane; otherwise, it is classified as a curved surface. The proposed method of combining multi-scale neighborhoods with covariance matrix eigenvalues can effectively make preliminary judgments on face types in the presence of noise and outliers in point cloud data [18].