People are more sensitive to changes than absolutes. Using this insight we can improve image blending by copying over the changes (gradients) from some source image to a target image rather than the pixels themselves. The examples below illustrate the drastic effect that copying changes rather than pixels can have on a blended image.
The basic idea behind blending using gradients is that instead of copying the pixels of some source into a destination, you are copying the changes in pixel values in each of the R, G, and B channels. For this project I implemented two methods of copying.
The first method, called Poisson blending aims to copy the gradients of the source image into the destination image. This is done by minimizing the sum squared error of the gradients in the first image with the gradient of the combined (source + target) image.
The second method, called mixed blending aims to copy the larger of either the source or target gradients. Thus, if the target image has a larger gradient (such as in an image of a New York city street), the gradient of the target image is used rather than the gradient of the source image.
|
|
|
| source | target | copying pixels |
|---|
|
|
|
| source | target | copying pixels (water texture not preserved, click for larger) |
|---|
|
I used mixed blending to blend in some fake graffiti on a wall. The mixed blending allows for the wall texture to bleed into the text, so that it looks like the text is painted on the wall. To make the text look more authentic, I used a 'dirty eraser' in photoshop to give the impression that some of the graffiti had worn off. |
|
|
|
| source | target | copying pixels |
|---|
While the cat blends amazingly well in this picture, it has an unfortunately blue tint to it due to color bleeding, causing the resulting image to look rather unrealistic. The perspective shift between me juggling and the cat also makes the photo look more unrealistic.
|
|
|
|
| source | target | copying pixels | using poisson blending (click for larger) |
|---|
One problem with mixed blending is that target images with large gradients (such as the image of new york below) bleed through too much, causing the blended item to look more like a ghost than a real item. This could actually be used to create interesting ghost effects, but in the case of the elephant in New York, didn't work out very well.
To further explore the impact of texture bleeding in mixed blending, I created the image below, which is a sequence of walking men. The more complex the target region, the more the texture bleeds through, creating an interesting (and often undesirable) effect.