Image Inpainting Using Criminisi Algorithm

Resource Overview

Application Background: A sample-based texture synthesis image inpainting algorithm built upon the classic Criminisi algorithm, capable of restoring both grayscale and color images. Enhanced with C programming for improved execution speed, includes test images, thoroughly tested code ready for immediate execution. Key Technology: The core of Criminisi algorithm is an isophote-driven image sampling process.

Detailed Documentation

Application Background

This paper presents a sample-based texture synthesis image inpainting algorithm based on the classical Criminisi algorithm, capable of restoring both grayscale and color images. The implementation utilizes C programming to optimize code execution speed and includes test images. The code has undergone extensive testing to ensure error-free operation.

Key Technology

The core of Criminisi algorithm is an isophote-driven image sampling process. The algorithm implementation follows these key steps:

1. Given an input image, the user selects a target region Ω which will be removed and filled.

2. Define the source region Φ as the entire image I minus the target region (Φ=I-Ω), where the source region provides matching patches.

3. Set the patch window size, with a default of 9×9 pixels. In practical implementation, the window size should be slightly larger than the maximum texture element in the image.

4. Once these parameters are determined, region filling proceeds automatically. In the Criminisi algorithm implementation, each pixel maintains a color value (empty if no pixel exists) and a confidence value. The confidence value reflects the reliability of pixel information and remains unchanged once a pixel is filled. The code implements confidence propagation through neighborhood patches during the filling process.

5. During algorithm execution, patches along the filling front are assigned temporary priority values. These priorities determine the filling sequence, with priority calculation combining confidence terms and data terms based on isophote direction. The implementation uses a priority queue data structure to efficiently manage patch processing order.

This algorithm enables detailed preservation of texture information during image restoration, resulting in more authentic and natural reconstruction outcomes. The C-based implementation significantly enhances computational efficiency, making it suitable for practical image inpainting applications. The code structure includes optimized functions for patch matching, priority calculation, and confidence updating to ensure robust performance.