Assignment 2: Gradient Domain Fusion
Student name: Tianxiang Lin
Andrew ID: tianxian
Project Overview
This project aims at blending an object or texture into another background image seamlessly using Poisson Blending.
After selecting source and target regions to blend, the blend constraints are solved using the follwing formula:
v=vargmini∈S,j∈Ni∩S∑((vi−vj)−(si−sj))2+i∈S,j∈Ni∩¬S∑((vi−tj)−(si−sj))2.
where v is the resulting blending region, t is the target image and s is the source image. Finally, the blending region is copied to the background image to complete the blending process.
Toy Problem
For the toy problem, three objective functions need to be satisfied:
- Minimize ((v(x+1,y)−v(x,y))−(s(x+1,y)−s(x,y)))2, so the x-gradients of v should closely match the x-gradients of s.
- Minimize ((v(x,y+1)−v(x,y))−(s(x,y+1)−s(x,y)))2, so the y-gradients of v should closely match the x-gradients of s.
- minimize (v(1,1)−s(1,1))2.
The result is as follows:

Poisson Blending
As mentioned above, the objective function to blend the source and target images is:
v=vargmini∈S,j∈Ni∩S∑((vi−vj)−(si−sj))2+i∈S,j∈Ni∩¬S∑((vi−tj)−(si−sj))2.
Notably, in order to avoid computing gradients twice, for each pixel in the source region, 4 gradients are added up to one row instead of seperated into 4 rows. This will save time for computations. The results are shown below.
| Name |
Source |
Target |
Result |
| Bear |
 |
 |
 |
| Statue |
 |
 |
 |
| Plane |
 |
 |
 |
All results are perfect blended except for the third one. An obvious artifact in front of the plane is not eliminated. The reason for this is the texture of the sky does not match to the texture of mountain.