# Weighted Similarity-Confidence Laplacian Synthesis for High-Resolution Art Painting Completion
## 3 Methodology
### Weighted Similarity-Confidence Laplacian Synthesis
In the subsequent phase, the algorithm refines the search for the most similar patches between the \(S\) and \(T\) at different levels. This process aims to achieve more accurate matching of areas, ensuring a robust foundation for subsequent completion efforts:  
\[E_{i}(T,S)=\sum_{q\in T}min_{p\in S}\left[w_{q}D(Up_{i,p},Up_{i,q})+w_{q}D( Lp_{i,p},Lp_{i,q})\right] \tag{2}\]  
Figure 1: Weighted Similarity-Confidence Laplacian Synthesis. (**a**) Input: an art painting with missing regions, (**b**) multi-region input and its mask, (**c**) Weighted Laplacian Synthesis, (**d**) patch-based propagation, (**e**) result of Weighted Laplacian Synthesis, (**f**) result of patch-based propagation; (**g**) output: a restored art painting. where \(Up_{i,p}\) and \(Lp_{i,p}\) represent patches of the \(Up\) and \(Lp\) pyramids at level \(i\) and location \(S\), while \(Up_{i,q}\) and \(Lp_{i,q}\) exhibit patches of the \(Up\) and \(Lp\) pyramids at level \(i\) and location \(T\). The variable \(D\) represents a maximum distance metric between two pixels, \(p\) and \(q\). The pursuit of determining the optimal pixel value for completing a missing region was a critical aspect influencing the overall performance of image completion. The approach proposed by [PERSON] et al. (2018) involved a weighted blending of scales between the upsampled Gaussian \(Up_{i}\) and Laplacian image \(Lp_{i}\), aiming to establish the most effective similarity between the target and source areas. However, this method introduced a voting system sensitive to detecting similarity, assuming that all pixels located outside of the current target area at the given level would be considered. Unfortunately, this could lead to challenges, as the current target region might not have been fully propagated from the nearest neighbor of the most recently restored area, resulting in a color discrepancy that failed to blend seamlessly with adjacent patches. In response to this challenge, our method innovates the voting similarity function, enhancing its capabilities by considering the potential overlap of nearest neighbor pixels in color, even across different levels. This improvement is achieved by incorporating the advanced weighted average vote \(c_{q}\), which not only provides a measure of similarity but also introduces a confidence weight, denoted as \(w_{q}\). This combined approach leads to a more refined and accurate estimation of optimal pixel values:  
\[w_{q}=\Psi(p,q,i)\Lambda(q),\qquad\Psi(p,q,i)=e^{-\frac{D(p,q,i)}{2\sigma^{2}}} \tag{3}\]  
\[c_{q}=\frac{\sum_{\tilde{q}\in Q}w_{\tilde{q}}E_{i}(T,S)}{\sum_{\tilde{q}\in Q }max(\tilde{q})} \tag{4}\]  
where \(\Psi(p,q,i)\) and \(D(p,q,i)\) are instrumental in characterizing the similarity and distance between the source pixel \(p\) and target pixel \(q\) at level \(i\). \(E_{i}(T,S)\) is a nearest neighbor search algorithm based on Equation (2). Additionally, \(\sigma\) serves as a determinant of the sensitivity for detecting similarity. Further refining the process, \(\Lambda(q)\) introduces a confidence weight at target pixel \(q\), strategically designed to alleviate boundary errors. This confidence weight assigns a higher value to target points closer to the completion boundary, ensuring a more robust performance. The culmination of these factors is encapsulated in the weight \(w_{q}\) at the target pixel \(q\). Moreover, the variable \(\tilde{q}\) denotes the overlapping colors from its nearest neighbor field, while \(Q\) represents the total number of \(\tilde{q}\). These components contribute to a comprehensive assessment of similarity and confidence, laying the foundation for precise and accurate weighting at the target pixel level. Completing high-resolution paintings that encompass complicated structures and textures can introduce errors, particularly in the form of ambiguity within the restored pixels. This ambiguity may manifest as color discrepancies and blurriness in the final restored image.