Project 2: Poisson Image Editing
 cs195-g: Computational Photography Patrick Doran Spring 2010 pdoran
Directory
Algorithm
High level description of the algorithm.
1 Reshape the source, mask, and target so they all have the same dimensions.
2 Create a sparse matrix that is #pixels x #pixels and initialize the diagonal to 1s (MATLAB optimization). This is the coefficient matrix. Also initialize the solution vector values for those pixels not in the mask. Their final values will be their value in the target.
3 Iterate over indices of white pixels in the mask and determine the system of equations:
 Coefficient matrix -1 for neighbor pixels within the mask 0 for neighbor pixels outside the mask N Number of neighbors the pixel has (4 except at image edges) Solution vector f* pixels not in the mask (these pixels will be the same as their input values) sum(v) + sum(f*) sum(gradient(Current-Neighbor in source image)) + (sum(Neighbors in target) if neighbor is not in the mask)
4 Solve the system of equations
5 Repeat for each color channel and combine.