Ruslan Aiginin - Computational photography (15-663) Project 3

Gradient-domain fusion

The goal of this project was to explore gradient-domain processing, which allows to seamlessly blend an object from one image to another. This is possible through Poisson blending.

The following formula:


where v is the result image, s is source and t is the target image, allows to create a set of equations (the amount of equations for pictures presented varies from tens of thousands for small images like the toy picture to over a million for larger ones), by solving which we get new pixel intensities. The left part of the formula is responsible for aligning gradients within the blending area, while the right part is responsible for aligning them with the rest of the image.

Toy problem

Initially, I tried this on a small black-and-white Buzz Lightyear picture. I restored the picture using its gradients. The difference is not visible through a naked eye.

Original picture «Restored

Poisson blending

The pictures below are presented in the following order: Target image, source image, result.

The penguin picture was provided with the assignment.





This is an example of a failed attempt I had during long hours of doing this project. For this picture the second part of the equation, which aligns gradients with the target image, was not implemented.



I pasted the sinking Titanic into the picture of Niagara Falls.






This is one of the main streets of my home town, Kazan, Russia. I realized that a dragon is missing.




Note that in this case the result image has some issues: the dragon still has a piece of sky from the source picture attached to him.


Beware! Hulkbuster from the upcoming movie Avengers: Age of Ultron is on the streets of Pittsburgh!




Unfortunately, even though the algorithm did its job perfectly (no white background), the Hulkbuster looks unrealistic at least because he has no shadow.


Mixed blending

To test Mixed blending, which is another gradient-domain processing technique, I put one of my favorite quotes on the picture I took at CMU campus yesterday. The picture shows summer being converted into autumn, which along with the quote means that each summer shall eventually pass.





Concusion

Implementing Poisson blending was quite tough. The hardest part was translating the formula into Matlab language. I would like to thank professor Kris Kitani and teaching assistant Akanksha Saran for helping me with this project.

All target images except for the folks on the mountain are taken from my Instagram. All the other images belong to their authors.

This is my Project 3 for Computational photography (15-663) class at CMU. See also Project 1 and Project 2.