Project 2G: Gradient Domain Editing

Julia Schwarz
andrew id: julenka

Project Description

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.

Good Results

Elephant in New York (favorite Poisson blending)

I really like this result because the blended result captures the feel of the target image. Although the source elephant is not at all washed out, the elephant ends up having the same washed out appearance as the target image in the blended result. This is in stark contrast to the result obtained when just copying pixels, where the elephant stands out like a sore thumb. NOTE: The blended image was NOT converted to greyscale, the result just turned out mostly greyscale.

source target copying pixels

Walking on Water (poisson blending and mixed blending)

I first tried to create a man walking on water using poisson blending, but noticed that the pixels in between the man's legs did not have the same texture as the water. Using mixed blending produced a much better result as the texture from the water was copied in between the man's legs.

Legs with Poisson Blending Legs with Mixed Blending
source target copying pixels (water texture not preserved, click for larger)

Fake Graffitti (mixed blending)

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

Bad Results

Me Juggling a cat (failure case for poisson blending due to color bleeding)

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)

Failure case for mixed blending due to texture bleeding

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.

Exploring texture bleeding

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.