Assignment #2: Seam Carving
CS 674 Computational Photography

mural image, full size mural image, carved horiz


Due Date: 2:00pm on Thursday, Oct. 5, 2017

Overview

In this assignment, you'll be implementing the basic algorithm presented in the SIGGRAPH Seam Carving for Content-Aware Image Resizing by Shai Avidan and Ariel Shamir. 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.

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 Points)

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

Deliverables

The project will be graded out of 130 points, with points allocated as noted below and above.

To turn in your assignment, you will need to deliver a zipped file (Use these guidelines to deliver your files) containing the following:

Reaction Report: Reaction report of the original SIGGRAPH 2007 paper (worth 20 points). The report has to be written according to the following guidelines.

Code: Please supply all the code you used to generate your results, along with a README file to allow us to test it out. (Basic dynamic programming seam horizontal and vertical carving is worth 50 points. 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, and put it in a sub-folder. By now you know the drill: simple html, nothing too complicated. Please:

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

NOTE 2: Students have to add some bells and/or whistles in order to achieve or surpass 130 points.

Acknowledgements

This assignment is derived from Alexei A. Efros, and used here with permission.