Git Product home page Git Product logo

cv-imageblending's Introduction

"Image Gradient Blending"

Objective

The objective of the assignment was to implement Image Blending to seamlessly blend an object from a source image into a target image.

Results

alt text alt text alt text


alt text alt text alt text

File Structure:

  • Readme.txt
  • script.py
  • seamlessCloningPoisson.py
  • createMask.py
  • drawMask.py
  • getIndexes.py
  • getCoefficientMatrix.py
  • getSolutionVect.py
  • maskImage.py
  • reconstructImg.py
  • 1_background.jpg (Given)
  • 1_source.jpg (Given)
  • 1_mask.png (Given)
  • 1_output.png - Generated (Minion + Ben Franklin on the bench)
  • 2_background.jpg
  • 2_source.jpg
  • 2_mask.png
  • 2_output.jpeg

To run the project for the given image, simpy run script.py.

This will open a pop up to select the mask for the source image, which can then be done by clicking the boundary points of the source image to create the mask.

To run the code for other images,

change the file name as the source image in line number 10 and line number 12 of script.py. Also, update the background image name in line number 11 of script.py. OffsetX and Offset Y would also have to be changed according to the images selected and the position of the source image in the target image.

Description of files:

  • script.py: runs the code by reading the source and target images, setting the offsets and calling createMask and seamlessCloningPoisson.
  • getIndexes.py: indexes the replacement pixels in the mask such that each element in x represents one replacement pixel
  • getCoefficientMatrix.py: Computes the NxN (N is the number of replacement pixels) matrix A to get the intensities of replacement pixels by solving Ax=b.
  • getSolutionVect.py: generates the solution vector b in the linear system Ax = b.
  • seamlessCloningPoisson.py: solves the equation Ax=b, by calling all the above functions for all three channels of the images and further calls reconstructImg
  • reconstructImg : basically replaces the calculated replacement pixel intensities in the target image
  • createMask.py: used to create the mask for the image

cv-imageblending's People

Contributors

tejas0809 avatar

Watchers

James Cloos 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.