CS 194-26: Final Project
Seam Carving, Fake Miniatures, and Vertigo Shots
Ellen Hong & George Geng
Seam Carving
Overview
In this project we implement the seam carving algorithm, which will allow us to effectively resize images without losing any information. In other words, we will be able to change the aspect ratio of an image without merely cropping out or distorting any part of it; instead, we maintain the most important components of the image while throwing away the unimportant components.
This algorithm works in the following way: We first assign each pixel to its corresponding "importance" value via an energy function. We use the energy function detailed in this paper, which is the gradient of each pixel. We then go through the image and, one by one, remove the seam with the lowest importance. This optimal seam is determined from the following dynamic programming recurrence relation for each pixel (i, j):
Below are some of the results of horizontal seam carving:
House
|
House, 200 seams removed
|
Sunset
|
Sunset, 300 seams removed
|
Dog
|
Dog, 200 seams removed
|
Examples of vertical seam carving:
Bush
|
Bush, 200 seams removed
|
Horse
|
Horse, 150 seams removed
|
Snails
|
Snails, 150 seams removed
|
Stars
|
Stars, 200 seams removed
|
Some not as successful results, which displayed a bit more distortion:
Below, the left side of the house has lost the top window.
House
|
House, 200 seams removed.
|
Because the background had so much going on, the legs of the deer were cut off instead:
Deer
|
Deer, 200 seams removed.
|
Straight diagonal lines are not preserved:
Building
|
Building, 200 seams removed.
|
The circle on the bottom is slightly distorted:
Circles
|
Circles, 200 seams removed.
|
Vertigo Shot
Overview
In order to achieve the vertigo shot effect, we can take a series of photographs in which we alter the field of view while we move farther and farther away from the subject. To achieve this, we increase our distance to the subject and then increase zoom at the same rate, so that the object maintains its size across all shots. Below are results of the photos along with animated gifs of vertigo shot sequences:
Tilt Shift
Overview
The world is a large and unmanageable place, so no wonder if we are drawn to miniatures. From model train sets to bonsai trees, we have found ways of humanizing the gigantic and often intimidating dimensions of much of life. A photographic approach to miniaturizing the world is through tilt-shift photography. "Tilt" refers to the rotation of the lens plane relative to the image plane, which adjusts the depth of field, and "shift" refers to the movement of the lens parallel to the image plane, which adjusts the position of the scene.
What makes a scene look miniature is a narrow depth of field, creating the illusion that the lens was close to the subject. We can simulate this by defining a focus region by selecting a focus line, and a size of a focus region several pixels around the focus line. We blur the areas outside this focus region with Gaussian blur, blurring more at distances further away. Finally, we increase the saturation of the overall image, increasing the toy-like illusion.
NYC
|
NYC, miniaturized
|
French Castle
|
French Castle, miniaturized
|
Paris
|
Paris, miniaturized
|
Eiffel Tower
|
Eiffel Tower, miniaturized
|
Santorini
|
Santorini, miniaturized
|
Scenes with multiple striated depth planes give the best results for miniaturization, which can be particularly seen the in picture of New York City. Now, the big concrete jungle seems kind of cute.
We took some of our own pictures and tried it on them too. Here is the view from Berkeley's Big C hike.
Big C
|
Big C, miniaturized
|
A street and some houses in San Francisco; in addition to aerial shots, sloping city streets work well too!
SF
|
SF, miniaturized
|
SF Houses
|
SF Houses, miniaturized
|
Don't the people look so cute, like you can put them your pocket?
Monterey
|
Monterey, miniaturized
|
Finally, we took a sequence of pictures of traffic from a highway overpass and miniaturize them to create a small animation of a miniature world come to life. It's a small world after all.
Little Cars Going
|