scs logo Programming Project #2 (proj2)
15-463: Computational Photography

mural image, full size mural image, carved horiz
Seam Carving
Due Date: 11:59pm on Friday, September 30, 2011

Overview

One of the recent papers at SIGGRAPH that made news was Seam Carving for Content-Aware Image Resizing by Shai Avidan and Ariel Shamir. In this assignment, you'll be implementing the basic algorithm presented therein. To wit, you'll be designing a program which can shrink an image (either horizontally or vertically) to a given dimension.

Details

For a brief overview of the algorithm and some inspiring results, check out the video. Your algorithm will shrink images as follows:

  1. Determine the 'importance' each pixel has using an energy function.
  2. Until image has shrunk to the desired dimension:
    1. Find the lowest-importance seam in the image.
    2. Remove it.

Feel free to use any energy function in the paper (or cook up something on your own). Defining a good energy function seems to be the key to achieving good results.


Seam examples. Black: horizontal seam. Gray: vertical seam. Green: not a seam -- contains more than one pixel from some columns.

A horizontal seam is a connected path from one side of the image to the other that chooses exactly one pixel from each column. (A vertical seam is the same, but from top to bottom and with rows.) Finding the lowest-importance seam is a simple dynamic programming exercise. If you find yourself spending large amounts of time on it, please ask the course staff for help.

Your final code should be able to, given an input image, produce an output image shrunk by a given number of pixels either in width or in height (but not both at once!). A simple way to achieve this goal is to write your code to shrink only in one dimension and then create a wrapper function that transposes the image to shrink in the other dimension.

Example: Horizontal Carving

house image, full size house image, carved horiz

Example: Vertical Carving

Notice how the content in the image is preserved, and the large, boring, area of asphalt is removed. (This does ruin the composition, but such is life.)

couch image, full size couch image, carved vert

Example: Carving Artifacts

As you push the algorithm to its limits, artifacts -- such as shape distortions and odd cubist angles -- will begin to crop up. A lot of time on this project will be spent tweaking your code to mitigate these effects, as well as searching for pictures which don't exhibit them. Generally, highly-structured scenes and human faces will suffer, while scenes with textured objects on simple backgrounds will work better.

self portrait image, full size self portrait image, carved horiz

Bells & Whistles (Extra Credit)

Try some special moves to up your multiplier, chain a longer combo, and increase your score:

Deliverables

The project will be graded out of 100 points, with points allocated as noted below and above. Use the proj2/www and proj2/code folders, as described in the submission instructions.

Code: Please supply all the code you used to generate your results, along with a README file or sufficient comments to allow us to test it out. (Basic seam horizontal and vertical carving is worth 50 points for those in the undergrad version of the class, 30 points for the grad version. On top of this base score, you will earn points for your report [see Web below].)

Web: Create a project page to showcase your results. By now you know the drill: simple html, nothing too complicated. Please:

NOTE: Your example images don't need to be larger than the above examples (i.e. around 500x500 pixels).