Research Article | Open Access

Volume 2018 |Article ID 3950312 | 8 pages | https://doi.org/10.1155/2018/3950312

# On Surface Completion and Image Inpainting by Biharmonic Functions: Numerical Aspects

Accepted11 Jan 2018
Published27 Feb 2018

#### 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 well-known results include Urysohn’s Lemma, the Tietze Extension, and Whitney’s Extension Theorem (see, e.g., ).

Inpainting was first introduced in  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 minimum-energy models as the recovered image. The most commonly used density function for these energy models is total derivation.

In , 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 . In , several surface completion methods have been studied. An optimal bound for the errors of the cubic inpainting method in  is given. Applications to smooth inpainting have also been discussed in . 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 , the author proposed to use -harmonic functions for smooth surface completion and smooth surface inpainting. Later in , -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  uses , , as boundary data while the method in  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 .

In , the following result for cubic inpainting is proved.

Theorem 1 (cubic inpainting, Theorem  6.5 ). 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 , 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  that if solves the equation then A sharper error bound than (10) is obtained in .
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  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 5-point finite difference scheme to approximate the Laplacian operator. This 5-point scheme is based on the following well-known 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 5-point finite difference scheme, (16) is reduced to the following algebraic system:where is the 5-point 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 bi-Laplacian, we use a 13-point finite difference scheme which is based on the following formula (see ): 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 five-diagonal 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 scikit-image processing in python unit completely at the disposal of the reader which readily provides quantitative correlations—in particular for the figures. The scikit-image processing package is at http://scikit-image.org/ and is a collection of open access algorithms for image processing with peer-reviewed code.

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)Denoise-bilateral (see ).(ii)Denoise-nl-means (see ).(iii)Denoise-tv-bregman, denoise-tv-chambolle, denoise-wavelet, estimate-sigma, inpaint-biharmonic (the present paper), nl-means-denoising, richardson-lucy, unsupervised-wiener, unwrap-phase, Wiener-Hunt 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 .

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 , and by the biharmonic extension from .

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  in this experiment yields numerical results with accuracy a bit higher than the method in . However, this does not imply that the method in  is better in terms of accuracy than the method in . In the condition number of A, the finite difference approximation to the bi-Laplacian 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  yields results with higher accuracy than the algorithm using the method in . As we can see in later experiments, the method in  often gives better results than the method in . 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  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  yields the best reconstruction. Although the biharmonic extension method from  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  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 .

 0 2.36 0.37 −1.46 1 0.50 −3.48 −5.34 2 −1.46 −7.44 −9.32 3 −3.45 −11.44 −13.31 4 −5.45 −15.43 −17.31 5 −7.45 −19.43 −21.31 6 −9.45 −23.43 −25.31 7 −11.45 −27.43 −29.31 8 −13.45 −31.43 −33.34 9 −15.45 −35.46 −38.54

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  yields the best restoration while the biharmonic reconstruction in  yields the worst reconstruction.

#### Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

1. P. Shvartsman, “The Whitney extension problem and Lipschitz selections of set-valued mappings in jet-spaces,” Transactions of the American Mathematical Society, vol. 360, no. 10, pp. 5529–5550, 2008. View at: Publisher Site | Google Scholar | MathSciNet
2. P. Shvartsman, “Whitney-type extension theorems for jets generated by Sobolev functions,” Advances in Mathematics, vol. 313, pp. 379–469, 2017. View at: Publisher Site | Google Scholar | MathSciNet
3. 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
4. S. B. Damelin and C. Fefferman, On Smooth Whitney Extensions of almost isometries with small distortion, Interpolation and Alignment in RD-Part 1, arxiv: 1411.2451.
5. S. B. Damelin and C. Fefferman, On Smooth Whitney extensions of almost isometries with small distortion in Cm(Rn), arxiv: 1505.06950.
6. 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
7. 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
8. 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
9. 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
10. 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
11. M. Bertalmio, A. Bertozzi, and G. Sapiro, “Navier-stokes, 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. I-355–I-362, Kauai, HI, USA. View at: Publisher Site | Google Scholar
12. T. F. Chan and J. Shen, Image Processing and Analysis, SIAM, Philadelphia, Pa, USA, 2005. View at: Publisher Site | MathSciNet
13. 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
14. C. K. Chui and H. N. Mhaskar, “MRA contextual-recovery 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
15. 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
16. 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
17. A. Buades, B. Coll, and J.-M. Morel, “A non-local 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
18. 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
19. J. Froment, “Parameter-Free Fast Pixelwise Non-Local Means Denoising,” Image Processing On Line, vol. 4, pp. 300–326, 2014. View at: Publisher Site | Google Scholar

#### More related articles

We are committed to sharing findings related to COVID-19 as quickly and safely as possible. Any author submitting a COVID-19 paper should notify us at help@hindawi.com to ensure their research is fast-tracked and made available on a preprint server as soon as possible. We will be providing unlimited waivers of publication charges for accepted articles related to COVID-19. Sign up here as a reviewer to help fast-track new submissions.