Code Monkey home page Code Monkey logo

poisson-matting's Introduction

Poisson Matting

Implementation of the paper - 'Poisson Matting by Jian Sun, Jiaya Jia, Chi-Keung Tang and Heung-Yeung Shum'

Packages Required

Use the package manager pip to install scipy, pillow, imageio, and cv2.

pip3 install scipy
pip3 install pillow
pip3 install imageio
pip3 install opencv-python

The basic packages of numpy and matplotlib are also required.

pip3 install numpy
pip3 install matplotlib

If imageio/pillow is already installed, make sure to upgrade the version of pillow being used before running the code.

pip3 install --upgrade pillow

Downloading the repository

Use the commands bash terminal

git clone {url of the page}

or

Click 'Clone or Download' on the top right hand side of the repository.

Usage

Go into the directory which holds all the files. Then open the Jupyter Notebook using the command -

jupyter-notebook

Working of the code

The inputs of the code are

  1. An input image
  2. Trimap of the input image (of the same size as the input)
  3. The desired background (of a size bigger than the foreground images)

Running each cell in order would give the desired results - the foreground of input image pasted on a different background.

While doing Local poisson matting, the user needs to manually select the region where the operations need to be performed. Looking at the image after global matting, we can see the range of the x and y coordinates where the pixels need to be altered. Hence this code can be customised depending on the input images and the needs of each user.

The final matte can be further refined by using methods like boosting and highpass filtering. For these two methods, the user must select the regions where the operations are to be done, and set the x and y coordinates in the code accordingly. For this particular image, we are using these two methods. You can also use methods like cloning and channel selection as per your needs.

poisson-matting's People

Contributors

gowrijsuria avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

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.