Project 2: Image Blending Writeup

Ben Cohen (btcohen)
February 17, 2010

Algorithm

Discrete Poisson Solver

To achieve the image blending, I implemented the discrete Poisson solver discussed in the paper. Although I modeled my implementation on the pseudocode that Patrick provided, I was forced to make a small change to solve a bug in my code. When I implemented the pseudocode, the resulting images were too dark under the mask (although the image outside of the mask was fine). To fix this, rather than adding QUnknown if Q was under the mask and QTarget otherwise, I just always added QUnknown. Since the value of QUnknown for pixels not under the mask is just QTarget, this is mathematically equivalent (I'm not sure why my code didn't work the other way, but this fixed my bug). The pseudocode of my implementation is below:

Transparency

For extra credit I implemented transparency. Following the suggestion in the paper, rather than always adding the gradient in the Source image, I add the greater of the Source gradient and the Target gradient. This allows features in the Target image to be displayed even if they are obscured by the Source image. The 3rd image ( rainbow + palm trees) illustrates the difference that transparency makes; without transparency, the rainbow becomes a smear across the sky and the trees, but when it is enabled, the rainbow appears in a much more realistic manner.

Results

Below are the results of running my algorithm on the supplied scenes, as well as on five other scenes I constructed. For all the supplied scenes, my program produces very reasonable images. The only noticeable issues with the images are the blue tint of the bear in the second picture and the dark splotch in the upper right side of the third image. The transparency also works well in all but the fifth image, where the faces blend together into a very strange looking face.

My scenes had slightly more mixed results. The first scene (Alex + owl), works very well without transparency, but the owl barely changes when transparency is enabled. The second scene (eagle + mountain) works well both with and without transparency. The third scene (me sitting on the moon) did not work at all; I think that the black background may have dominated the scene, causing me to become almost solid black. The fourth scene (shark + helicopter) also didn't work very well; the shark became too tinted (like the bear in the pool scene), making the picture look fairly unrealistic. In the final scene (Nell + tiger), the blending leaves the tiger too ghostly to be realistic.

Required Images

(click to see full size images)
Transparency Disabled Transparency Enabled

Additional Images

+
=

Transparency Disabled

Transparency Enabled

+
=

Transparency Disabled

Transparency Enabled

+
=

Transparency Disabled

Transparency Enabled

+
=

Transparency Disabled

Transparency Enabled

+
=

Transparency Disabled

Transparency Enabled