15-463 Project 3

Seam Carving

Overview

Seam carving is a method for resizing images while preserving content. Rather than cropping the edges, seam carving tries to remove unimportant pixels. Each pixel is assigned an energy, and then the seam (path of connected pixels) with the lowest energy is removed.

Energy Function

I used Sobel edge detection to compute pixel energy.

Examples

Removed 100 vertical seams.
Removed 50 vertical seams. The algorithm mostly did a good job choosing what to remove, but there are some artifacts (lines that should be vertical are not quite).
Removed 150 vertical seams. This image works well because there are no straight lines to be disrupted.
This image is in some ways ideal for seam carving, because it is high contrast on a very plain background. We can remove many seams (in this case 500 vertical seams followed by 300 horizontal seams) without disrupting the content at all.
Removed 400 vertical seams, then 400 horizontal seams. Similar to above case, but not quite as ideal because the background has some detail.
Removed 200 horizontal seams.

Bells and Whistles

I implemented object removal by seam carving. The user selects a region, pixels in this region are given large negative energies to attract seams, and then seams are removed until the object is entirely gone.
The algorithm was able to remove the reflection of the Washington Monumument without disrupting the monument itself.
It was able to remove one of the stars.

Failures

The uninteresting parts of this image, between the monuments, have high energy due to all the lights and reflections, so the algorithm instead removes the more-interesting bridge.
Too many seams were removed here (300 vertical, then 400 horizontal), destroying the pattern.
The program was less successful at removing the tree, because the background is not as uniform.

Image Sources

Trees Gates Starry Night Birds Sunset Spiral DC