Image inpainting with weight variation of neighborhood window

Meng Wang, Donghai Zhai, Hongyu Nie, Jiajun WangJournal of Image and Graphics 2015

Published in: Journal of Image and Graphics

Abstract

Traditional exemplar-based image inpainting algorithms often struggle when damaged regions are surrounded by both complex geometric structures and rich textures. In such cases, common issues include "texture extension" and the selection of incorrect sample blocks. This research proposes an improved algorithm based on the weight variation of the neighborhood window. By constructing a weighting factor using total variation and intrinsic variation, the algorithm enhances the priority measurement of the Criminisi framework, ensuring that geometric structures are repaired first. Additionally, a global structure difference operator is integrated into the patch-matching process to improve accuracy. Experimental results demonstrate that the proposed method effectively overcomes texture bleeding and mis-matching, maintaining visual connectivity and achieving a PSNR improvement of approximately 2–3 dB over traditional methods.

Introduction: The Challenge of Structure vs. Texture

Image inpainting aims to restore missing or corrupted parts of an image in a way that is visually undetectable. The Criminisi algorithm, a cornerstone of exemplar-based inpainting, works by iteratively filling the "hole" with patches sampled from the intact parts of the image.

However, a persistent challenge in this field is the ambiguity between structure (defined by sharp edges and geometric lines) and texture (repetitive patterns like grass or fabric). When an algorithm fails to distinguish between the two, it often propagates textures into smooth edges—a flaw known as "texture extension"—or creates discontinuities where lines should meet. This paper addresses these issues by refining how the algorithm prioritizes which areas to fix first and how it selects the best matching patches.

Methodology

The researchers introduced two significant enhancements to the standard inpainting pipeline:

1. Neighborhood Window Weight Variation ($W(p)$)

To ensure that the "skeleton" of an image is restored before the finer details, the authors developed a new priority weighting factor, $W(p)$. This factor is derived from two components calculated within a neighborhood window:

  • Total Variation ($T(p)$): Captures the overall intensity changes in the area.
  • Intrinsic Variation ($H(p)$): Measures the consistency of gradient directions.

By analyzing the relationship between these two metrics, the algorithm can identify whether a region contains a primary geometric edge (high $T(p)$ and high $H(p)$) or a busy texture (high $T(p)$ but low $H(p)$). This allows the system to prioritize structural repair, preventing textures from overwhelming the geometric flow of the image.

2. Global Structure Difference Operator ($D_2$)

Standard patch matching typically relies on the Sum of Squared Differences (SSD) of color values. While effective for simple regions, SSD can lead to misalignments in complex scenes. The authors introduced a structural term ($D_2$) that evaluates the similarity of gradient magnitudes and orientations between patches. By combining color and structural matching, the algorithm ensures that the chosen replacement patch fits both the appearance and the geometric logic of the surrounding area.

Experimental Results and Insights

The algorithm was tested against several benchmarks, including the "Barb," "Baboon," "Bird," and "Beach" datasets.

Quantitative Performance

The proposed method consistently outperformed the original Criminisi algorithm and other modern variants (such as those by Ren et al. and Xu et al.) in terms of Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity Index (SSIM). For instance, on the highly textured "Barb" image, the proposed method achieved a PSNR of 32.78 dB, a significant improvement over the original algorithm's 29.54 dB.

Qualitative Quality

Visually, the method excels at maintaining continuity. In object removal tasks (e.g., removing a person from a beach scene), the algorithm preserves the smooth, continuous line of the horizon and coastline, whereas previous methods often introduced jagged artifacts or "bleeding" textures from the surrounding sand or water.

Conclusion

By incorporating neighborhood weight variation and structural matching, this research provides a more robust solution for image inpainting in complex scenes. The method effectively mitigates the common pitfalls of exemplar-based restoration, such as texture extension and patch misalignment. Future work may involve optimizing the computational efficiency of these global searches or integrating this weighting logic into deep-learning-based inpainting frameworks to handle larger semantic gaps in images.

Summary updated

BibTeX
@article{wang2015image,
  author = {Meng Wang and Donghai Zhai and Hongyu Nie and Jiajun Wang},
  title = {{Image inpainting with weight variation of neighborhood window}},
  journal = {Journal of Image and Graphics},
  year = {2015},
  doi = {10.11834/jig.20150802},
}
Figure