Harvey Mudd College
Computer Science 182a
Project 1, problem 2
Due Sunday, January 30, 2011

Note: this is only one of two options for the second problem in this project. I'll be posting the other option by Thursday, 1/20... .



"Finding edge cases": Implementing seam carving

Thanks to K. Grauman for this assignment, and to Avidan and Shamir for the algorithm!



Goals

For this exercise, you will implement a version of the content-aware image resizing technique described in Shai Avidan and Ariel Shamir's SIGGRAPH 2007 paper, "Seam Carving for Content- Aware Image Resizing." The paper is available here: http://www.seamcarving.com/arik/imret.pdf. The goal is to implement the method, and then examine and explain its performance on different kinds of input images.

Tasks

First read through the paper, with emphasis on sections 3, 4.1, and 4.3.

Then, write functions to do the following tasks. This assignment may be completed using either OpenCV or Matlab - the choice is yours. You may work on your own or in pairs.

Coding hints

Matlab pointers:

OpenCV pointers:

Demo and write-up

Be sure to demo your system by 4:30pm on 9/26... . The write-up should be linked into the CS 153 wiki by 11:59pm on Sunday, 9/28.

For your write-up, create another web- or wiki-page to hold the write-up from this assignment. As noted in the syllabus, the items below will be graded on a scale of up to B+. In order to extend that grading scale up to an A, you should implement an extension of your own choosing. (A number of possible extensions are listed below.)

  1. Run your resizeH function on the provided ocean.jpg image with newWidth = 540. Display the output in your write-up.
  2. Display (a) the energy function output (total gradient magnitudes e1(I)) for the provided image ocean.jpg, and (b) the two corresponding cumulative minimum energy maps (M) for the seams in each direction - similar to the inset in the paper's Figure 1. Explain in a sentence or two why these outputs look the way they do given the original image's content.
  3. For the same image ocean.jpg, display the original image together with (a) the first selected horizontal seam and (b) the first selected vertical seam. Explain briefly why these were chosen as the optimal seams for this image.
  4. What if we were to modify the energy function to include only gradients in one direction, i.e., only one of the addends in equation 1? Explain in a setence or two how the output (selected seams) would qualitatively change? Choose any image where we might expect a difference, and show an illustrative example using the original and modified energy function.
  5. Examples and testing!    Now, for the real results! Use your system with different kinds of images and seam combinations, and see what kind of interesting results it can produce. The goal is to form some perceptually pleasing outputs where the resizing better preserves content than a blind resizing would, as well as some examples where the output looks unrealistic or has artifacts.

    Include results for at least one more of the four provided images, as well as at least four images of your own choosing. Include at least one new example of "good" outcomes and at least one new example of "bad" outcomes. Be creative in the images you choose! Try to predict types of images where you might see something interesting happen. It's certainly ok to fiddle with the parameters (seam sequence, number of seams, etc) to look for interesting and explainable outcomes.

    For each result, include (a) the original input image, (b) your chosen resized image (using seam carving), (c) the result one would get if instead a simple resampling were used (Matlab and OpenCV have functions named imresize and cvResize for this), (d) the input and output image dimensions, and (e) a qualitative explanation of what we're seeing in the output.

Extension possibilities

These are some ideas for possible extensions. Feel free to come up with your own instead... .

If you choose to implement one of these or another extension, be sure to include a description of what you did - and some of the results - in your write-up!