# Point Cloud Repair Method via Convex Set Theory
## 2 Methods
### Filtering of Spatial Subunits
#### 2.4.2 Fine Screening  
To ensure that the repaired point-cloud surface was closer to the real surface, the filtering results needed to be further refined. The Markov random field (MRF) [28] is an undirected probability graph model that is a random field with Markovian characteristics. The value of each node is only related to the surrounding nodes. The K-nearest neighbor (K-NN) graph of an unordered point cloud is an undirected graph constructed by connecting each point with its nearest K neighbors [5]. Therefore, we introduced MRF, took the geometric attributes of local point clouds as the observational information, and transformed the fine screening of elements into the maximal a posteriori (MAP) of random field labeling. Given an incomplete 3D point-cloud model \(P\), let \(G(V,E)\) represent MRF, where \(V\) represents a set of voxels, and \(E\) represents a set of edges connecting subunits. Each subunit \(v_{i}\in V\) was assigned a label \(l_{i}\in\{0,1\}\). The units retained after rough screening were regarded as an unstable label set, and recorded as Label 0. Similarly, the units with 3D points in their neighborhood were recorded as 1. Let \(L=\{l_{i}\}\in\{0,1\}^{|V|}\) be a set of labels. We optimized the energy of the subunits with \(l_{i}=0\); that is, we determined whether the subunit needed filling points. First, the state distribution function of the MRF was obtained according to the Hammersley-Clifford theorem:  
\[P(L)=Z^{-1}\prod_{Q\in\mathbb{C}}\psi_{Q}\big{(}L_{Q}\big{)}, \tag{2}\]  
where \(z\) is the normalization factor to ensure that \(P(L)\) forms probability distribution. \(Q\) is a subgroup, \(C\) is a group set, and \(\psi_{Q}\) is the potential energy function corresponding to group \(Q\) that is used to model the variable relationship in group \(Q\). To ensure the non-negativity of the potential energy function, \(\psi_{Q}\) is defined as follows:  
\[\psi_{Q}\big{(}L_{Q}\big{)}=exp^{-\big{\{}x_{i}\sum_{i\in V}V_{i}(l_{i})+\beta_ {i}\sum_{j,i\in E}V_{i,j}(l_{i}J)\big{\}}}, \tag{3}\]where \(\alpha_{i}\) and \(\beta_{(i,j)}\) are adjustable parameters. The former only considers the potential energy of a single node, while the latter considers the relationship between each pair of nodes. \(V_{i,j}(l_{i},l_{j})\) represents the cost of placing labels \(l_{i}\), \(l_{j}\) at two adjacent subunits \(i,j\):  
\[V_{i,j}(l_{i},l_{j})=exp^{1-\frac{1}{1+\omega\left(n_{i}\omega_{j}\right)+ \alpha}}, \tag{4}\]  
where \(\alpha=0.000001\) to avoid 0 denominators, and \(n_{i}\) and \(n_{j}\) are the normal surface vectors formed by the subunit's central point and the set of neighboring points. Similarly, \(V_{i}(l_{i})\) represents the observational cost of a single cuboid unit \(i\) in each state \(l_{i}\). \[V_{i}(l_{i})=logP(n_{i}|l_{i}). \tag{5}\]  
Like the traditional Markov random field, likelihood function \(P(n|l)\) is established as follows:  
\[P(n|l)=\prod_{i=1}^{N^{1}}P(n_{i}|l_{i})=\prod_{i=1}^{N^{1}}\frac{1}{\sqrt{2\pi \
u_{l_{i}}}}\prod_{i=1}^{N^{1}}\frac{1}{\sqrt{2\pi\mu_{l_{i}}}}. \tag{6}\]  
where \(P(n|l)\) represents the joint probability of observational variable \(n\) when the state \(l\) of MRF is given. When building the label field model of MRF, we used \(M\) Gaussian distributions to fit the histogram distribution of the normal vector information of the surface formed by the central point of the unstable subunit and the neighboring point set. \(M\) indicates that labels are divided into several categories. In this paper, labels were divided into two categories, \(M=2\). The expectation maximization (EM) algorithm was used to calculate the mean \(\mu=\{\mu_{1},\mu_{2},\cdots\mu_{M}\}\) of the M Gaussian distributions and standard deviation \(\sigma=\{\sigma_{1},\sigma_{2},\cdots\sigma_{M}\}\). The detailed solution process of the likelihood function can be found in [29].