Research Article  Open Access
S. B. Damelin, N. S. Hoang, "On Surface Completion and Image Inpainting by Biharmonic Functions: Numerical Aspects", International Journal of Mathematics and Mathematical Sciences, vol. 2018, Article ID 3950312, 8 pages, 2018. https://doi.org/10.1155/2018/3950312
On Surface Completion and Image Inpainting by Biharmonic Functions: Numerical Aspects
Abstract
Numerical experiments with smooth surface extension and image inpainting using harmonic and biharmonic functions are carried out. The boundary data used for constructing biharmonic functions are the values of the Laplacian and normal derivatives of the functions on the boundary. Finite difference schemes for solving these harmonic functions are discussed in detail.
1. Introduction
The smooth function extension problem is a classical problem that has been studied extensively in the literature from various viewpoints. Some of the wellknown results include Urysohn’s Lemma, the Tietze Extension, and Whitney’s Extension Theorem (see, e.g., [1–9]).
Inpainting was first introduced in [10] and then has been studied extensively by several authors (see, e.g., [11, 12]). Although smooth image inpainting is a smooth function extension problem, the most common approach in image inpainting so far is to use the solution to some PDE which are obtained from minimumenergy models as the recovered image. The most commonly used density function for these energy models is total derivation.
In [12], by considering smooth inpainting as a smooth surface extension problem, the author studied methods for linear inpainting and cubic inpainting. Error bounds for these inpainting methods are derived in [12]. In [13], several surface completion methods have been studied. An optimal bound for the errors of the cubic inpainting method in [12] is given. Applications to smooth inpainting have also been discussed in [13]. There, error bounds of completion methods are derived in terms of the radius of the domains on which the functions are completed. In one of the methods in [13], the author proposed to use harmonic functions for smooth surface completion and smooth surface inpainting. Later in [14], harmonic functions are also studied for smooth surface completion and inpainting. The differences of the method using harmonic functions in [13, 14] are as follows: the method in [13] uses , , as boundary data while the method in [14] uses , , as boundary data to solve for a harmonic function. Here, is the function to be inpainted and is the boundary of the inpainted region.
The goals of this paper are to implement and compare the performance of the two surface completion schemes in [13, 14]. In particular, we focus our study on smooth surface completion and smooth surface inpainting by biharmonic functions.
2. Surface Completion by Biharmonic Functions
Let be a simply connected region in with boundary and be the diameter of . Let be a smooth function on any region containing . Assume that is known on a neighbourhood outside . The surface completion problem consists of finding a function on a region containing such that There are several ways to construct the function so that (1) holds. For smooth surface completion, one is often interested in finding a sufficiently smooth function satisfying (1).
An application of smooth surface completion is in smooth image inpainting. In smooth image inpainting, one has a smooth image which is known in a neighbourhood outside of a region while the data inside is missing. The goal of image inpainting is to extend the function over the region in such a way that the extension over the missing region is not noticeable with human eyes.
In image inpainting, an inpainting scheme is said to be of linear order, or simply linear inpainting, if, for any smooth test image , as the diameter of the inpainting region shrinks to 0, one has where is the image obtained from the inpainting scheme. Here, denotes the norm. Here and throughout, if is bounded uniformly by some constant .
Note that harmonic inpainting, that is, the extension found from the equation is a linear inpainting scheme [12].
In [12], the following result for cubic inpainting is proved.
Theorem 1 (cubic inpainting, Theorem 6.5 [12]). Let be the harmonic inpainting of . Let be a linear inpainting of on (not necessarily harmonic), and let be defined bywhere solves Poisson’s equationThen, defines a cubic inpainting of ; that is,
Remark 2. If is the harmonic inpainting of in , that is, solves the equation then the element defined by (4) is a biharmonic function which solves the following problem: In [13], this result is generalized to a multiresolution approximation extension scheme in which the Laplacian is replaced by more general lagged diffusivity anisotropic operators. It is proved in [13] that if solves the equation then A sharper error bound than (10) is obtained in [13].
Equation (9) can be written as a system of Poisson’s equations as follows: Thus, the problem of solving (9) is reduced to the problem of solving Poisson’s equations of the form Numerical methods for solving (12) have been extensively studied in the literature.
Note that the normal derivatives are not presented in (9). Thus, extension using (9) may not be differentiable across the boundary . To improve the smoothness of the extension across , it is suggested to find from the equation It is proved in [14] that if is the solution to (13), then (10) also holds.
Equation (13) cannot be reduced to a system of Poisson’s equations as (9). In fact, to solve (13), one often uses a finite difference approach which consists of finding discrete approximations to the operators and , . For “large” , it is quite complicated, though possible, to obtain these approximations.
As we can see from the above discussions, (9) is easier to solve numerically than (13). However, scheme (9) does not use any information about the normal derivatives of the surface on . Thus, the extension surface, obtained from scheme (9), may not be smooth across the boundary . On the contrary, (13) uses normal derivatives as boundary data and, therefore, is expected to yield better results than scheme (9) does.
In the next section, we will implement and compare the two surface completion schemes using (9) and (13). In particular, we focus our study on biharmonic functions which are solutions to (9) and (13) for .
3. Implementation
Let us discuss a numerical method for solving the equation To solve this equation, one often defines and solves for from the following system: Thus, the problem of solving (15) is reduced to the problem of solving the following Poisson’s equation: To solve (16), we use a 5point finite difference scheme to approximate the Laplacian operator. This 5point scheme is based on the following wellknown formula:Here, is the discretization step size. This scheme is well defined at points , whose nearest neighbours are interior points of . If has a neighbour , then we use a stencil of the formIn the above formula, is the nearest neighbour to the left of . Similar formulae when is the nearest neighbour on the top, in the bottom, and to the right of can be obtained easily.
In our experiments, we choose as a square and the solution on the computation grid is presented as a vector. Using the 5point finite difference scheme, (16) is reduced to the following algebraic system:where is the 5point finite difference approximation to the Laplacian and is a vector containing boundary values of on at suitable entries. Matrix is a tridiagonal matrix; that is, all nonzero elements of lie on the main diagonal and the first diagonals above and below the main diagonal. Matrix can be obtained by the function delsq available in Matlab.
Let us discuss a numerical method for solving the equation For a discrete approximation to the biLaplacian, we use a 13point finite difference scheme which is based on the following formula (see [15]): This stencil is well defined for a grid point if all its nearest neighbours are in the interior of the domain. If has a neighbour and is on the left of , then we use the following formula:
Using the above finite difference scheme, (20) is reduced to a linear algebraic system of the form , where is a fivediagonal matrix. Numerical solutions to on the grid can be obtained by solving this linear algebraic system.
Before we proceed with numerical experiments, we need the following.
3.1. Quantitative Comparisons
It is constructive to provide quantitative correlations between original and processed images and in particular code to compare figures such as those below. In order to calculate these required correlations (and many are provided), we refer the reader to a free access code for our method in scikitimage processing in python unit completely at the disposal of the reader which readily provides quantitative correlations—in particular for the figures. The scikitimage processing package is at http://scikitimage.org/ and is a collection of open access algorithms for image processing with peerreviewed code.
For our method, see http://scikitimage.org/docs/stable/api/skimage.restoration.html?highlight=biharmonicskimage.restoration.inpaintbiharmonic.
Moreover, for the benefit of the reader, many comparison methods with associated code are given in this unit; see some below, but see the full package for a longer list with references.(i)Denoisebilateral (see [16]).(ii)Denoisenlmeans (see [17–19]).(iii)Denoisetvbregman, denoisetvchambolle, denoisewavelet, estimatesigma, inpaintbiharmonic (the present paper), nlmeansdenoising, richardsonlucy, unsupervisedwiener, unwrapphase, WienerHunt deconvolution.
4. Numerical Experiments
4.1. Smooth Surface Completion
Let us first do some numerical experiments with smooth surface completion. In our experiments, we compare numerical solutions from the three surface completion methods: the method with harmonic functions, the method with biharmonic functions in [12, 13], and the method with biharmonic functions in [14].
The function to be completed in our first experiment is Note that this function is a biharmonic function. The domain is discretized by a grid of size points. In the first experiment, we used .
In our numerical experiments, we denote by the extension by a harmonic function, by the biharmonic extension from [13], and by the biharmonic extension from [14].
Figure 1 plots the original function and the error of reconstruction by a harmonic function. Figure 2 plots the errors of surface reconstructions by biharmonic functions from [13, 14].
From Figures 1 and 2, one can see that the biharmonic reconstructions from [13, 14] are much better than the reconstruction by harmonic functions. The method in [13] in this experiment yields numerical results with accuracy a bit higher than the method in [14]. However, this does not imply that the method in [13] is better in terms of accuracy than the method in [14]. In the condition number of A, the finite difference approximation to the biLaplacian in this experiment is larger than that of the finite difference approximation to the Laplacian. Due to these condition numbers, the algorithm using the method in [13] yields results with higher accuracy than the algorithm using the method in [14]. As we can see in later experiments, the method in [14] often gives better results than the method in [13]. The conclusion from this example is that both methods in [13, 14] yield numerical solutions at very high accuracy. The harmonic reconstruction in this experiment is not very good. This stems from the fact that the function to be reconstructed is not harmonic.
In the next experiment, the function to be reconstructed is chosen by This function is not a biharmonic function.
Figures 3 and 4 plot the errors of harmonic and biharmonic reconstructions. From these figures, it is clear that the method in [14] yields the best approximation. The harmonic reconstruction is the worst amongst the 3 methods in this experiment.
4.2. Image Inpainting
Let us do some numerical experiments with image inpainting.
Figure 5 plots a damaged image and a reconstructed image by harmonic functions. Figure 6 plots restored images by biharmonic functions following the methods from [13, 14].
It can be seen from Figures 5 and 6 that the biharmonic extension method from [14] yields the best reconstruction. Although the biharmonic extension method from [13] is better than harmonic extension in our experiments with smooth surface completion, it is not as good as the harmonic extension in this experiment. This is understandable since our image contains edges and is not a smooth function. It can be seen from the restored image by the method in [13] in Figure 6 that the reconstruction may not be smooth, or even differentiable, across the boundary.
Appendix
Table 1 presents numerical results for the function defined by (24) and on the domain , . The diameter of is . From Table 1, one can see that the harmonic reconstruction has an order of accuracy of while the biharmonic reconstruction methods have an order of accuracy of 4. This agrees with the theoretical estimates in [12–14].

Figures 7 and 8 plot a damaged picture of peppers and reconstructed images by the 3 methods. From these figures, one gets the same conclusion as in the previous experiment. The biharmonic reconstruction in [14] yields the best restoration while the biharmonic reconstruction in [13] yields the worst reconstruction.
Conflicts of Interest
The authors declare that there are no conflicts of interest regarding the publication of this paper.
References
 P. Shvartsman, “The Whitney extension problem and Lipschitz selections of setvalued mappings in jetspaces,” Transactions of the American Mathematical Society, vol. 360, no. 10, pp. 5529–5550, 2008. View at: Publisher Site  Google Scholar  MathSciNet
 P. Shvartsman, “Whitneytype extension theorems for jets generated by Sobolev functions,” Advances in Mathematics, vol. 313, pp. 379–469, 2017. View at: Publisher Site  Google Scholar  MathSciNet
 Y. Brudnyi and P. Shvartsman, “Whitney's extension problem for multivariate C1,ωfunctions,” Transactions of the American Mathematical Society, vol. 353, no. 6, pp. 2487–2512, 2001. View at: Publisher Site  Google Scholar  MathSciNet
 S. B. Damelin and C. Fefferman, On Smooth Whitney Extensions of almost isometries with small distortion, Interpolation and Alignment in RDPart 1, arxiv: 1411.2451.
 S. B. Damelin and C. Fefferman, On Smooth Whitney extensions of almost isometries with small distortion in Cm(Rn), arxiv: 1505.06950.
 C. Fefferman, S. B. Damelin, and W. Glover, “A BMO theorem for ε and an application to comparing manifolds of speech and sound Involve,” A Journal of Mathematics, vol. 5, no. 2, pp. 159–172, 2012. View at: Publisher Site  Google Scholar  MathSciNet
 C. Fefferman, “Whitney's extension problems and interpolation of data,” Bulletin (New Series) of the American Mathematical Society, vol. 46, no. 2, pp. 207–220, 2009. View at: Publisher Site  Google Scholar
 E. J. McShane, “Extension of range of functions,” Bulletin (New Series) of the American Mathematical Society, vol. 40, no. 12, pp. 837–842, 1934. View at: Publisher Site  Google Scholar  MathSciNet
 H. Whitney, “Analytic extensions of differentiable functions defined in closed sets,” Transactions of the American Mathematical Society, vol. 36, no. 1, pp. 63–89, 1934. View at: Publisher Site  Google Scholar  MathSciNet
 M. Bertalmio, G. Sapiro, C. Ballester, and V. Caselles, “Image Inpainting,” in Proceedings of the 27th annual conference on Computer graphics and interactive techniques (SIGGRAPH '00), pp. 417–424, July 2000. View at: Publisher Site  Google Scholar
 M. Bertalmio, A. Bertozzi, and G. Sapiro, “Navierstokes, fluid dynamics, and image and video inpainting,” in Proceedings of the 2001 IEEE Computer Society Conference on Computer Vision and Pattern Recognition. CVPR 2001, pp. I355–I362, Kauai, HI, USA. View at: Publisher Site  Google Scholar
 T. F. Chan and J. Shen, Image Processing and Analysis, SIAM, Philadelphia, Pa, USA, 2005. View at: Publisher Site  MathSciNet
 C. K. Chui, “An MRA approach to surface completion and image inpainting,” Applied and Computational Harmonic Analysis , vol. 26, no. 2, pp. 270–276, 2009. View at: Publisher Site  Google Scholar
 C. K. Chui and H. N. Mhaskar, “MRA contextualrecovery extension of smooth functions on manifolds,” Applied and Computational Harmonic Analysis , vol. 28, no. 1, pp. 104–113, 2010. View at: Publisher Site  Google Scholar
 P. Bjorstad, “Fast numerical solution of the biharmonic Dirichlet problem on rectangles,” SIAM Journal on Numerical Analysis, vol. 20, no. 1, pp. 59–71, 1983. View at: Publisher Site  Google Scholar  MathSciNet
 C. Tomasi and R. Manduchi, “Bilateral filtering for gray and color images,” in Proceedings of the 6th International Conference on Computer Vision (ICCV '98), pp. 839–846, Bombay, India, January 1998. View at: Google Scholar
 A. Buades, B. Coll, and J.M. Morel, “A nonlocal algorithm for image denoising,” in Proceedings of the 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, CVPR 2005, pp. 60–65, usa, June 2005. View at: Publisher Site  Google Scholar
 J. Darbon, A. Cunha, T. F. Chan, S. Osher, and G. J. Jensen, “Fast nonlocal filtering applied to electron cryomicroscopy,” in Proceedings of the 5th IEEE International Symposium on Biomedical Imaging: From Nano to Macro (ISBI '08), pp. 1331–1334, IEEE, Paris, France, May 2008. View at: Publisher Site  Google Scholar
 J. Froment, “ParameterFree Fast Pixelwise NonLocal Means Denoising,” Image Processing On Line, vol. 4, pp. 300–326, 2014. View at: Publisher Site  Google Scholar
Copyright
Copyright © 2018 S. B. Damelin and N. S. Hoang. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.