Trevor M. O'Brien
CS195-g: Computational Photography

Project 2: Image Blending


This project addresses the problem of seamlessly blending portions of one image, the source image, into another image, the destination image.


The algorithm I implemented to solve this problem comes from the paper Poisson Image Editing by Perez, et. al.

The algorithm requires a source image, a mask image that defines which portion of the source image will be used, a destination image, and a destination offset where the source will be placed. With these pieces defined, a large system of linear equations is constructed and solved to fill the masked portion of the destination image with the source image. As opposed to letting the region fill in via undirected diffusion, a guidance vector field taken from the source image directs the image fill process to provide nicer results.

Extra credit

For extra credit components, I implemented the mixed gradient component of Perez's algorithm. For each color channel, at each pixel in the masked region, instead of simply using the source gradient, I check to see if the destination gradient is larger. If it is, then that value is inserted into the Poisson system.

Sample Results

In general, I found the algorithm did not work well in most general, real world cases. Complex gradients in both source and destination images are clearly problematic for this algorithm. The best results I produced came from the mixed gradient approach using target images of phenomena like lightning and fireworks, which are naturally somewhat transparent. Results from my project can be seen in the Gallery .

Department of Computer Science, Brown University