Description of Project
This project is to perform image blending. Given a background image
and a foreground image, we would like to copy paste part of the
foreground onto the background. However, we would like to do some
processing so that this copy paste seems natural to the human eye.
Toy Example
First, we practice solving sparse least squares problems by using a
toy problem; the objective is to duplicate the input:
in 
out
Favorite Blend
source 
target 
source mask 
new source 
output comparison 
This works by masking the source to move to the target, and then solving
a sparse least squares where gradients within the source are preserved,
and gradients on the edge of the source and target are preserved form the source.
This ensures that images will look like natural additions. No bells / whistles.
Other Blend
source 
target 
source mask 
new source 
output comparison 
Bad Blend
source 
target 
source mask 
new source 
output comparison 
This one was not so good. This is because the gradient from the god rays
in the tree image leak strongly into the apple. Also we see here that
even if the gradient is smooth, that is not enough to make objects
appear as if they are natural; things like reflection, shadows and other
lighting artifacts also make a large difference.