Coder Social home page Coder Social logo

cdortona / image_inpainting Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 6.57 MB

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: MIT License

MATLAB 100.00%
image-inpainting image-restoration interpolation pde heat-equation numerical-methods neumann

image_inpainting's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.