The primary goal of this assignment is to seamlessly blend an object or texture from a source image into a target image.

*Part 1*

Toy Problem:

In this example we'll compute the x and y gradients from an image s, then use all the gradients, plus one pixel intensity, to reconstruct an image v. We then compute the difference to see if our created image is the same as our input

---------->

initial image----------------> blended image

See the difference? No? Good! That's the whole point.

*Part 2*

Poisson Distribution:

We can formulate our objective as a least squares problem. Given the pixel intensities of the source image "s" and of the target image "t", we want to solve for new intensity values "v" within the source region "S":

,-----> --->

initial images --------------------------------------------------------------> crude image --------------------------> blended image

Here, each "i" is a pixel in the source region "S", and each "j" is a 4-neighbor of "i". Each summation guides the gradient values to match those of the source region. In the first summation, the gradient is over two variable pixels; in the second, one pixel is variable and one is in the fixed target region.

*Part 3*

Mixed Blending:

Follow the same steps as Poisson blending, but use the gradient in source or target with the larger magnitude as the guide, rather than the source gradient:

,-----> --->

initial images --------------------------------------------------------------> crude image --------------------> blended image

Here "d_ij" is the value of the gradient from the source or the target image with larger magnitude, i.e. if abs(s_i-s_j) > abs(t_i-t_j), then d_ij = s_i-s_j; else d_ij = t_i-t_j. Show at least one result of blending using mixed gradients. One possibility is to blend a picture of writing on a plain background onto another image.

*Extra Credit*

Lets get FUNKY!

So while running blind through this project I came up with a bunch of unintended but awesome (at least, I think so) outputs. Here are a few and the educated reasoning as to why they happened.

NOTE: The reasoning for this images is a combination of back-tracking and intuition. I was more focussed on fixing the problem, so some of my reasons may not be accurate.

An output using just 2 gradients, the x+ and y+ gradients, but the interesting part; The intesity of the source image is used as the intensity base rather than the target. So the image is much brighter | |

Edge detection. How? Find and superimpose gradients but don't solve for the intensity variables | |

Not enough gradients. Fun note: As long as the sizes match for computation, Matlab randomly chooses not to tell you that your matrices are not aligned sensibly (this maybe because of using a sparse matrix) . This happened when my sparse matrix A was twice as tall as my gradient matrix b. | |

I.don't.know. But I love it. | |