Home

Awesome

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: