Description
  Poisson Blending
  Mixed Gradients
  Tone Mapping
  One more thing
  Credits
About    Ricardo Cabral (rcabral).
   15-862 Computational Photography, Fall 2010.
   Project 2.

› Project Description

  The purpose of this exercise is to show how powerful editing in the gradient domain is. Specifically, we explore concepts such as blending and tone mapping. The gradient domain here is a natural domain in which to explore these concepts, since blending has to do a lot with edge smoothing of the images being blended, and edges are nothing but high variations of a pixel and its neighbors in one given direction. The framework proposed is a Least Squares minimization for the pixels of the blended image such that it preserves the gradients inside the object being affixed as the foreground while maintaining the gradients in the edges of the said image as similar as possible to the gradients of the background image to minimize blending artifacts on the frontier of the blending. Since the cost function to be minimized is the sum of squared errors, it is easily formulated in a Least Squares framework, as an overdetermined set of equations which can be solved using a pseudo-inverse.

Back to top

› Poisson Blending

I wanted to keep on the penguins theme, so i first remembered the most known penguin in the Computer Science Dept. When i called him, he told me he was hanging out with the boys :

Then, i took my ship out of the garage and visited the pole to take a couple of pictures :

An then, after i finished with this, i was hungry as a bear :

Back to top

› Mixed

  I knew i had to convince my professor that i knew this technique well enough to get a good mark in the project, so i remembered that he might take the word of a few friends of his (Gauss, Galileo and Newton) so i went over to them and asked for a recommendation letter. Here is what they sent me:

This, unfortunately, has a very forged look and the illumination shadows caused by the brightest lamp are not well modeled. These phenomena can be explained, in fact, by the main statement on which this technique is based, which is the human eye is very sensitive to changes in gradient and not so much to pixel absolute values; as such, the images look bad due to the fact that we are replacing the background with a foreground which has smaller gradient magnitudes around this area. Using mixed gradients, which automatically selects the maximum gradient for each pixel from the foreground and background. This approach yields much better results for the blending with varying illumination, rendering a much nicer "recommendation letter":

Back to top

› HSV2Gray

This can be viewed as a mixed gradients problem: we wish to preserve the values of the gradients of both the saturation and value channel, but here the optimization variable is common among both because we wish our output to be a uni-dimensional range of intensities for each pixel (i.e., greyscale). We need, however, an additional equation giving the value of any pixel so as to provide the constant necessary for computing an inverse of a gradient with integration. The results below show the result of this optimization using several criteria for this equation (setting the first pixel to, resp., the hue component, the saturation component and the output of rgb2gray for that pixel):

Since these results appear to be brighter than the values found in matlab's rgb2gray function, we added an extra term to the minimization: now, it only optimizes the difference of gradient between the target image and the hue, sat channels as well as the result of rgb2gray. As can be seen from the results below, for the same initialization constant, the results are darker and approximate more the contrast of rgb2gray while maintaining the constrast of the number so it's readable:

Back to top

› One more thing...

Finally, just for fun, i decided to put the penguins moving: i applied mixed blending to each frame of an animated GIF with penguins to the desktop of a Windows XP machine. The result is a march of the penguins which can be found here (couldn't convert it back to animated GIF within matlab, so the result is an avi file created with matlab's movie2avi function)
Back to top

› Credit where credit is due

The signatures for galileo, gauss and newton were taken from wikipedia (i didn't find poisson's, unfortunately). The pictures for blending were found using google images, so the original source is kept in the original file metadata. Back to top