Skip to content

Image inpainting algorithm based on two methods: Interpolation and Diffusion through the resolution of a linear PDE. This was my project for the Numerical Methods class held at the Univeristy of Bologna, Italy.

License

Notifications You must be signed in to change notification settings

CDOrtona/Image_Inpainting

Repository files navigation

Image Inpainting - PDE Linear Diffusion

forks stars license


Table of Content

Introduction

This is a fairly simple program that has been coded with the aim of performing image inpainting on damaged images and it works with both RGB and gray-scale images. Two different techniques have been used:

  1. Interpolation
  2. Explicit solution of a linear PDE

The following image, used for this case study, has pixels which have worn off over time. Those damaged regions are the ones we wish to inpaint and reconstruct. (In this repo you can find more example pictures which can be used to test the algorithm).

The damaged regions are highlighted by the following mask:

Interpolation

Those pixels of the input image, which show no sign of wear, have been modeled as scattered data and they have been used in order to define the interpolant. Two interpolants were defined: one for the linear interpolation and the other for the Nearest Neighbour interpolation. The output image obtained as a result of the algorithm is the following:

Linear PDE

The second inpainting technique involves the solution of the following linear PDE using the explicit method.

where

Such PDE is similar to the heat equation and permits the inpainting of the image through an isotropic diffusion. A more in depth mathematical analysis of the problem can be found Here . (Please note that the doc is currently n Italian, the math part should be pretty straight forward though 😆)

The result of the algorithm is the following:

This PDE has two problems:

  1. It doesn't take into account damaged pixels which might be part of the borders.
  2. The PDE performs an isotropic inpainting, hence the edges aren't taken into account.

Neumann Boundary Condition

The first issue has been addressed and solved by implementing the Neumann boundary condition.

As an example have a look at how an image would look without and with such boundary condition:

Future Implementations

  • Higher order non linear anisotropic PDE in order to have a weighted, edge preserving diffusion along the edges.

License

Distributed under the MIT License. See LICENSE.txt for more information.

About

Image inpainting algorithm based on two methods: Interpolation and Diffusion through the resolution of a linear PDE. This was my project for the Numerical Methods class held at the Univeristy of Bologna, Italy.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages