# Project 2: Image Blending

## Diana Huang (dkh) - February 17, 2010

### Description

For this assignment, we were asked to implement Poisson image blending. This method is designed to algorithmically blend two images together, instead of relying on human skill to blend the two images into one.

In order to implement this, I used the formulas given to find a good average between the current pixel and its neighbors. We found these averages by solving a system of linear equations as specified in the handout by using a sparse matrix.

### Extra Credit

As extra credit, I added in transparency as an option in the program, using the formula given in the paper to decide which pixel values to take, those of the source image or those of the target image.

### Results Images

#### Provided Images

All of these images turned out well, almost exactly as they were expected to. The program still takes a while on some of the large images with large masks, probably due to the for-loops used to construct the array.

#### My Own Images

These are a mixed bag. I used a combination of my own pictures along with images I found on the internet.

##### Image One

This one was my first attempt, and it failed quite spectacularly. The biggest problem with this one was that the background of the source image of Obama was too 'noisy' since he was addressing a crowd. The algorithm wants to keep those parts sharp and visible. It was rendered without transparency. If I had the time to go back and rerun the algorithm, I could probably get slightly better results with a better image mask, one that cut out more of the background.

Source:

Target:

Result:

##### Image Two

This image was my attempt to put a garden gnome in Mordor. It uses transparency, and you can see that the algorithm does a good job of matching the lighting of the scene, but it over-compensates, making the image too dark.

Source:

Target:

Result:

##### Image Three

In this one, I was curious to see how Obama performed on a different background. This one also uses transparency. I set the offset lower for this image, which helps a little with the blending, but you can still see the little bits of people's heads at the bottom. Overall, a much better success than the first image.

Source:

Target:

Result:

##### Image Four

This image uses a combination of one of my own images and an image I found on Flickr. This image does not use transparency. The image did not turn out that well. There's a strange discoloration at the feet, and the background texture of the source image is still mostly left in.

Source:

Target:

Result:

##### Image Five

This image is a return of the garden gnome, except a different garden gnome in a different location. This one used transparency. The color palate of the gnome's background and the target image were fairly similar, and as result the image turned out pretty well, with a few obvious discolorations in a few spots. The background image was also taken from Flickr.

Source:

Target:

Result: