A Directional Diffusion Algorithm for Inpainting

Jan Deriu, Rolf Jagerman, Kai-En TsayarXiv 2015

Abstract

Standard isotropic diffusion algorithms for image inpainting often fail to preserve sharp edges, resulting in blurred reconstructions in regions with high contrast. This paper introduces a Directional Diffusion Algorithm that leverages local image geometry to steer the reconstruction process. By estimating the dominant orientation within image patches and applying custom-rotated kernels, the method effectively continues structural edges into missing regions. Experimental results on text-masked images demonstrate that this approach achieves a lower Mean Squared Error (MSE) than traditional diffusion and sparse-coding methods, albeit with a higher computational cost.

Introduction

Inpainting is the process of reconstructing lost or deteriorated parts of images to maintain visual consistency. A common approach is diffusion, where information from known pixels is propagated into missing regions. However, traditional diffusion is typically isotropic, spreading information equally in all directions. While effective for small, random noise, this approach blurs sharp lines and edges because it lacks awareness of the underlying image structure. This paper addresses the challenge of reconstructing high-contrast edges by introducing a directional component to the diffusion process.

Methodology

The proposed algorithm utilizes a two-stage approach to move from a coarse estimate to a structurally aware reconstruction:

  1. Initial Estimate: A standard, fast isotropic diffusion algorithm is first applied to generate a rough, albeit blurry, version of the missing areas.
  2. Patch-Based Analysis: The image is partitioned into $n \times n$ patches. For each patch, the algorithm calculates three metrics based on pixel differences: verticality ($v$), horizontality ($h$), and a diagonal slant heuristic ($d$).
  3. Kernel Steering: These metrics are used to calculate a specific angle ($\theta$) representing the dominant direction of edges within the patch. A base kernel is then rotated to match this orientation.
Figure 5: Local orientation estimation on the 'Elaine' test image. The grid shows the calculated orientation vectors for each patch, which guide the directional diffusion.
  1. Directional Diffusion: The diffusion process is re-run on each patch using these custom-steered kernels. By weighing pixels along the detected edge more heavily than those across it, the algorithm effectively "draws" the structure back into the missing space.

Experimental Results

The researchers evaluated the algorithm using 17 grayscale images from the SIPI database, including standard test images like "Elaine" and "Splash." The performance was tested against random noise masks and structured text masks.

For text-based inpainting, the Directional Diffusion Algorithm (using 16x16 patches) achieved a Mean Squared Error (MSE) of 0.00055, outperforming regular diffusion (0.00061) and significantly surpassing sparse-coding methods (0.0015–0.0024).

Figure 1: Comparison of text inpainting using the directional diamond kernel. The method preserves the sharp edges of the characters compared to isotropic methods.

While the directional approach offers superior structural accuracy, it introduces a "complexity tax." Regular diffusion processed images in approximately 0.5 seconds, whereas the directional method required 8.7 seconds. However, it remained faster than sparse-coding techniques, which often exceeded 13 seconds.

Conclusion and Future Work

The Directional Diffusion Algorithm demonstrates that local image geometry provides a vital blueprint for high-quality inpainting. By treating images as collections of oriented structures, the method preserves the "flow" of a scene far better than isotropic alternatives. Future work will focus on reducing computational overhead through GPU parallelization and improving orientation estimation in complex patches where multiple edges intersect, potentially by incorporating gradient-based operators like the Sobel filter.

Summary updated

BibTeX
@misc{deriu2015directional,
  author = {Jan Deriu and Rolf Jagerman and Kai-En Tsay},
  title = {{A Directional Diffusion Algorithm for Inpainting}},
  year = {2015},
  eprint = {1511.03464},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1511.03464},
}
Figure