CS194 Final Project

Intro to Computer Vision & Computational Photography: Anderson Lam, Amy Huang

Gradient Domain Fusion

Overview: This project looks into gradient-domain processing with Poisson blending, in order to seamlessly integrate one object into another image. Below we demonstrate this process on a penguin image integrated into a snowy background.


Toy Problem

The toy problem consists of computing the x and y gradients of an image and reconstructing that image. We have 2 objectives:

After doing so, our output image looks like this:

Reference
Reconstructed
Reference
Reconstructed

Poisson Blending

Our poisson blending procedure is as follows:

  1. Select source and target boundaries and translate the object to the correct location in the target (using the given starter code).
  2. Use the following formula for finding blending constraints:
  3. Copy the solved value into the target image
Target Image
Source Image Translated
Mask
Blended Output
Target Image
Source Image Translated
Mask
Blended Output
Target Image
Source Image Translated
Mask
Blended Output

Failed Case:
The photos above were able to work well because the original background of the source objects were considerably similar to the background of the target image. Here we have a failed case with part of the source object not matching the background of the target image background.

Target Image
Source Image
Mask
Blended Output

Bells & Whistles: Mixed Gradient


We implemented mixed gradient to improve blending by doing a similar procedure as Poisson blending using the following formula

It's interesting to see how this simple mixed gradient could improve our results with comparison of the source and target values. Overall, this helped make the results look more realistic.

Poisson Blending
Mixed Gradient
Poisson Blending
Mixed Gradient
Poisson Blending
Mixed Gradient

Failed Case: Same problem as before, the blending is not believable with the different backgrounds.

Poisson Blending
Mixed Gradient

Bells & Whistles: Color2Gray


The concept of Color2Gray was to improve grayscale contrast since converting an image to gray can lose a lot of object distinguishing properties. At the moment, this is what a color blind test looks like when converted the grayscale (we lose all the information of the number). We want to implement something so that the contrast is kept similarly.

We accomplished this by converting the image to HSV and looking at the saturation and value. We do a similar process as Poisson blending but taking into account these parameters. Because it took a long time to process, we rescaled the images down.

Color blind test (color)
Color blind test (grayscale)
Color2Gray Output
Color blind test (color)
Color blind test (grayscale)
Color2Gray Output
Color blind test (color)
Color blind test (grayscale)
Color2Gray Output

Summary: This project was very interesting and show me a lot about how math and matrices work with respect to images. This was very different to how we did laplacian blending and was interesting to see other ways to blend. I really liked playing around with blending like in project 2! A big difficulty I had was really just understanding the math. The next difficulty came down to figuring out the how to solve the least squares problem efficently -- which was really slow in numpy/python. I had to find out which packages or procedures were faster than the more well know processes.