In this project, I implemented poisson blending. The goal is to seamlessly combine two images by blending them in the gradient domain. This is done by fixing the boundary of the target region as the target image while using the gradient information of the source image to find the least squares fit for the blended region.
The results are shown below:
In this toy problem, the gradient along x and y direction and the intensity of the top left pixel is used to reconstruct the image back as shown below.
The error between the two images is 5.1222e-06, which shows that the reconstructed image is very close to the original image.
Original Image | Reconstructed Image |
Original Images | Blended Image |
|
|
Roads: Favourite result | |
|
|
Submarine: The colour of the blended region has altered because of mismatch in the blue colour at the boundaries. | |
|
|
Coin: Even though the face colour in both the images are approximately same (brown), the blended colour has turned really yellow. This shows the strong dependence of poisson blending on the boundary colour. | |
|
|
Beach |
Original Images | Blended Image | Mixed Gradients Blended Image |
|
||
Matrix: Mixed gradient fills up the space between the text smoothly with the background. |
To capture the contrast and intensity of the color image in the gray scale image, we perform least squares fitting with two set of constraints.
1. The gradient should be similar to the gradient in the H,S component (HSV colorspace)
2. The intensity should be similar to the V component (HSV colorspace)
The result on the sample image is shown below.
Original Image | Grayscale Image | Color2Gray Image |