Part 1: Toy Problem
We compute the gradient of the image in the x and y directions and use it to reconstruct the image v. We want to minimize three functions using least squares:
( v(x+1,y)-v(x,y) - (s(x+1,y)-s(x,y)) )^2
( v(x,y+1)-v(x,y) - (s(x,y+1)-s(x,y)) )^2
(v(0,0)-s(0,0))^2
Original Image
Blended Image
And error of 0+3.7665e-06i was recorded by MATLAB
Part 2: Poisson Blending
We use least squares to solve the following optimization constraint to blend the source image and the background image together:
Source image & Background image
Blended Image
Source image & Background image
Blended Image
Bells & Whistles (Color2Gray):
RGB image
Grayscale image