# Inpainting in Discrete Sobolev Spaces: Structural Information for Uncertainty Reduction
## 5 Uncertainty and Priority  
The inpainting process consists of two different phases: the _analysis_ of the similarity between patches (to determine the best fit) and the _synthesis_ of the unknown value. Both of these processes hide sources of uncertainty. In the analysis phase, the scanning order to inpaint \(\Omega\) plays a central role for the correctness of the reconstruction. In this direction, different works have tried to improve  
Figure 6: The inclusion of unknown points in \(\operatorname{supp}\chi\), during the minimization of \(E_{T}\), makes its calculation not effective. In the figure, it is assumed to use a square \(\operatorname{supp}\chi\), highlighted in yellow when centered in \((i,j)\), i e., at time \(t\), and highlighted in red when centered in \((i,j+1)\), i.e., at time \(t+1\). In fact, it results \(\min\{E_{T}((i,j),t)\}\
eq\min\{E_{T}((i,j),t+1)\}\), where the \(\min\) operation is performed all over the points belonging to the area that is not black. the confidence term firstly introduced in [35] (see [36; 42; 43] ). We shortly recall that in [35], the scanning order \(P(i,j)\) (also called priority) has been defined as  
\[P(i,j)=C(i,j)\cdot\frac{D(i,j)}{\alpha}\]  
where \((i,j)\in\Omega\), \(C(i,j)\) and \(D(i,j)\) are, respectively, the confidence term (what we called trustability before), and the data term: the first one estimates the uncertainty of the neighborhood, the second one considers the direction of intersection between the isophotes and the boundary \(\partial\Omega\) of \(\Omega\). Briefly,  
\[C(i,j)=\frac{\sum\limits_{(r,s)\in\text{supp}\,\chi^{\text{(supp}\,I}}C(r,s)}{ \#(\text{supp}\,\chi_{i,j})},\;\;D(i,j)=\frac{|\
abla^{\perp}_{(i,j)}\cdot n_{ (i,j)}|}{\alpha} \tag{4}\]  
where \(\#(\text{supp}\,\chi_{i,j})\) is the cardinality of the pixels in \(\text{supp}\,\chi_{i,j}\), \(\
abla^{\perp}_{(i,j)}\) is the isophote vector and \(n_{(i,j)}\) is the unitary vector orthogonal to \(\partial\Omega\). \(C(i,j)\) is initially set to one in every point of \(I\setminus\Omega\) (see [35] for a complete description). The value of \(P(i,j)\), being in the discrete, and consequently approximated asset, is strictly connected with the methods used to achieve \(\
abla^{\perp}_{(i,j)}\) and \(n_{(i,j)}\), whose calculation usually requires the introduction of a preprocessing stage by a Gaussian smoothing to reduce noise. Dramatically different reconstructions come out from different implementations of the same method. The contributions of \(C(i,j)\) and \(D(i,j)\) have been usually considered separated, as respectively explanatory of the uncertainty of the given data and the preferential direction of propagation of the isophotes [42; 43]. Both \(C(i,j)\) and \(D(i,j)\) belong to the interval \([0,1]\), given a suitable normalization coefficient \(\alpha\) (e.g., 255 if W=8). Exploiting this property, we can interpret them as probabilities. More precisely, \(C(i,j)\) is the probability to find a match, given a certain _trustable_ number of neighbor points, while, when \(D(i,j)\) is normalized, it expresses a probability connected with the structure, i.e., the morphology of \(I\) around \(\Omega\). The last statement follows from the properties of edges in images. In fact, points belonging to contours of an object are those points that generally are less numerous than other points, i.e., that are less probable to be found. An explanatory example is provided in Figure 7: to inpaint the Kanizsa [44] triangle we have to set the priority. As an example, we take into account of two plausible configurations of \(\chi\), being \(\text{supp}\,\chi\) highlighted in light green in Figure 7 and shown in the small squares on the right (in black the missing areas). It is evident that the number of points, in \(I\setminus\Omega\), compatible with the upper square is lower than the number of points compatible with the lower one. Thought in this way, \(D(i,j)\) individuates the directions along which there is a reduction of uncertainty in the choice of the best fit.