Project 2: Poisson Image Blending

Donnie Kendall (dkendall)

Algorithm

First, calculate the 4-way gradient for each source image pixel with all of its neighbors. This is saved into a matrix with the same dimensions as the source image.

The end goal is to represent the entire problem as a matrix equation Ax=b. b will contain the known pixel values for those places in the image the mask does not cover. The rows of A which correspond with these rows of b will be diagonal, with 1, to indicate that this is the one value for those pixels.

In the areas where the mask does cover, b will have the gradient values from the source image. The matching rows of A are a poisson blend of this gradient with the 4 surrounding pixels. At those pixels which are exactly on the border of the masked region the poisson blend extends into the original image, so the color information from there bleeds into the mask. This affects the overall hue of the mask, but it also makes the seam much less visible.

Results

The algorithm results in very good blending, but the hue of the source mask is affected in some cases. For example, in the bear-in-pool image the blue of the pool water has bled into the bear's fur, making him look somewhat sickly.

Below is given both the image with the graident shown as-is, and the image with the target mask properly blended in, in order to give an idea of how it works.

The graident on the rainbow below is very slight (and so, very dark) because of the way the colors slowly blend together. It is much more visible zoomed in at a high magnifcation.