Skip to content

Scripts written to blend given source and target images with a mask. Implemented using Pyramid and Poisson Blending.

Notifications You must be signed in to change notification settings

garychan22/image-blending

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image-blending

Image blending is the process of blending a source onto a target image with a mask such that it appears that the source is blending nicely into the target image's background. It can be implemented in a variety of ways. I have implemented Pyramid Blending and Poisson Blending.

The repo is organized in three folders:

  • Code : main.py contains the main blending code that works for images one to nine. getMask.py can be used to generate a mask for a given image.
  • Images : This folder contains all the source, target and mask images. They are numbered one to nine.
  • Results : This is the folder where the generated results are stored. All the blends for images one to nine are present here.

Running Code

To run the code, Python 3 and the following libraries must be installed:

  • numpy
  • cv2
  • scipy
  • matplotlib

Then simply use the following command to run with python:

python3 main.py

Examples of the blending are given below:

Pyramid Blending

Pyramid Blending is not as good as Poisson Blending, but can work well in certain cases. A good example is blending the source image of an apple:

apple image

with an orange

orange image

using Pyramid Blending results in this:

pyramid blend

Poisson Blending

Blending the following source:

plane image

with the following target:

sky image

results in the following:

poisson blend

About

Scripts written to blend given source and target images with a mask. Implemented using Pyramid and Poisson Blending.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%