CS194-26: Image Manipulation and Computational Photography

Programming Project #3: Fun with Frequencies and Gradients

Dennis Lee (cs194-26-acy)

Objective

Images can be manipulated in many ways. A blurry image can be sharpened. Two images can be stacked to form a hybrid, and a hybrid can be broken back into its component parts. Two images can also be combined by blending the edge between them, or elements of one picture may be transplanted to another. The objective is to implement all of these functions.

Sharpening

Sharpening can be done by increasing the "detail" of an image, where detail is captured by a laplacian filter.


A picture of a Japanese screen print, taken through glass at a museum.

The blurry picture is generated by... blurring the picture of Derek. We then resharpen it. Note that the sharpened image cannot fully recreate the original.

Hybrids

Two pictures can be made into a hybrid by stacking the details (determined by laplacian filter) of one picture on top of the base (created by gaussian filter) of another. From a distance, the details blur out and all that can be seen is the mean, but up close, the eyes focus on the details.


Hybrid of Derek and Nutmeg

Hybrid of a girl and potato.

Failure case since the low passed image is too light/indistinct,
it's hard to tell what it is.

Adding color helps a little

Former team leader, current cult leader

FFT of the cultist image

Un-hybrid

A hybrid image can be broken back down into approximately the component parts. By applying a gaussian filter, we blur out the details and are left with the base image. By applying a laplacian filter, we can extract only the detailed image. In the following images, the leftmost column is two (identical) copies of the original image.


Splitting the Dali painting

Splitting the hybrid image created above back into a man and his cat

Splitting one cat into two cats

Blending

Combining two images by directly pasting one on top of the other leads to a seam between the two. The images can instead be blended by fading one image into the other, but this may lead to artifacts where the details intersect. Instead of blending the base image, we can blend the images different amounts at each detail level - blending away the finer details further away from the seam.


An oraple

Spicy donut, using a circular spline

Two random places in Norway

Top - Lake, Middle - City, Bottom - Merged

Fusion

Human vision is better tuned to detect gradients rather than colors, so blending in the gradient domain often achieves better results. This algorithm attempts to maintain the internal gradients of the image on one side of the seam, while maintaining consistent gradients across the seam. Here "maintaining" means minimizing the least squares difference of the original and final gradients. The correct pixel values can be computed using a least squares optimizer.

Unsurprisingly, copying an image onto itself is not very interesting


March of the penguins, haunted by their ancestors

Someone is having a bad day

Directly copying the pixels.

Source

Target

Kavi is a basketball god

New species - dwarf orca

This one doesn't work so well because the orca's original background was much darker than the aquarium, so the colors were all lightened to maintain the gradients.



Laplacian Blending

Poisson Blending

The poisson blending technique leads to the volcano, photographed at night, becoming much brighter, but the image looks somewhat realistic. The laplacian blending has some artifacts, but using a smaller gaussian blend results in too sharp of a border. The resulting image is cleaner, but not realistic.