1
$\begingroup$

I'm working on a project that requires unknown image elements to be filled in, and am using a simple inpainting algorithm, which I would like to understand better. It works by repeatedly convolving a 3x3 filter (in 2D) with the image. The center point of the filter has coefficient zero (of course!), while the corners have $b = 0.073235$, and the vertical and horizontal coefficients are $a = 0.176765$

Here is a link to the paper I am using: Inpainting paper

I would like to understand how these were derived, but can't find the method in the literature. Note that $b/a \approx 2.41367 \approx \sqrt{2}+1$.

Of course, for normalization, $4 a + 4 b = 1$. I thought they might come from setting an approximation of the Laplacian = 0, but have gotten nowhere with this.

$\endgroup$

1 Answer 1

1
$\begingroup$

This is basically a computation of stencil coefficients for a finite difference method.

Expand each cell value in terms of the center using Taylor series. Note that $\Delta_{x} = \Delta_{y} = \Delta$ in this case.

For example,

$u_{i+1,j+1} = u_{i,j} + \Delta \left( u_{x} + u_{y} \right) + \frac{\Delta^{2}}{2} \left( u_{xx} + 2 u_{xy} + u_{yy} \right) + \cdots $

with all symbolic derivatives shown being evaluated at the center.

There are 8 variables(each cell) and 5 unknowns(each symbolic derivative), which form an underdetermined system. The aim is to approximate a Laplacian smoothing, thus $u_{i,j}$, $u_{xx}$ and $u_{yy}$ need to have coefficients of 1.

The Gaussian kernel is sometimes used as it satisfies the Laplace equation. The elements in the diagonal are further away from the center than the edge-centers. In fact, one can compute the Gaussian used here based on the weights.

$F = \mathcal{N}(0,\sigma^{2})$

$a = F(\sqrt{2})$

$b = F(1)$

On substituting the values provided, $\sigma \approx 0.75$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.