Giter Club home page Giter Club logo

poisson-image-editing's Introduction

Poisson Image Editing

This is a Python implementation of the poisson image editing paper to seamlessly blend two images.

For example, I'd like to put the Statue of Liberty under the shinning ocean. The right side compares the results from direct copying and the Poisson image editing.

In this notebook, I build the algorithm from scratch and explain each steps in detail. The code used in the notebook is extracted in the *.py files, you can also run it directly (see the next section for more instructions about how to run).

How to run

python main.py -s <source image> -t <target image> [-m <mask image>]

If the mask image is not specified, a window will pop up for you to draw the mask on the source image:

The green region will be used as the mask. Press s to save the result, press r to reset.

After the mask is defined, a window will pop up for you to adjust the mask position on the target image:

The mask corresponds to the region of source image that will be copied, you can move the mask to put the copied part into desired location in the target image. Press s to save the result, press r to reset.

Then the Poisson image editing process will start. The blended image will be named as target_result.png, in the same directory as the source image.

Structure

Here's a brief description of each file's functionality:

  • main.py: take command line argument and call paint_mask.py, move_mask.py and poisson_image_editing.py.

  • paint_mask.py: pop up a window for drawing the mask on the source image.

  • move_mask.py: pop up a window for adjusting the mask location on the target image.

  • poisson_image.editing.py: take source, target, mask image and mask offset, run the Poisson image editing algorithm for seamless image blending.

  • poisson_image.editing.ipynb: a notebook demonstrating the process.

poisson-image-editing's People

Contributors

pppw 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.