Computational Photography

Project 2: Gradient Domain Editing

You Jia (youj)

Mission Overview

In this project, we sample a couple of image editing algorithms that are based on gradient domain operations. The main idea throughout is to explicitly set up constaints on the gradients (i.e. pixel differences) of an image, and then solve for the actual pixel values that best match the constraints, usually in term of the least square measure.

Toy Problem

To see that this basic script is running correctly, both removing the small gradients and removing the large gradients are tried.


Original Image
remove small gradients remove large gradients
cumsum along y
gradient restore

Poisson Blend

Now the magic blending part.

Example One
penguins
blended into elsewhere
Example Two
source images
blend together
Example Three
plane
and the fleet

Mixed Blend

Mixed gradient blending is helpful in some special situations.

dora on grass name in water
source
target
result

NPR Effects

NPR effects can be achieved by simply getting rid of smaller gradients like in the toy problem.

Also, we can enhance some strong edges to better depict the shapes.
The outlook from my bedroom's window, and the NPR'ed version.
However, this simple method usually doesn't work well for highly textured surfaces, such as grass and this hairy ear, mostly for the reason that there are too few low gradient pixels among these regions.
Yet another example with line enhancement. Totally flattened the grass this time by setting a larger threshold on gradients.

Color2Gray

Converting color image to gray scale image by looking at the HSV space and blending the S and V channels together with the standard rgb2gray results using the mixed gradient method.
Though this gives out not longer a faithful representation of the original image.