15-463: Computational Photography

Project 2: Seam Carving

Eugenio Dominguez
edomingu@andrew.cmu.edu

For this project the task was to implement the algorithm described in the paper "Seam Carving for Content-Aware Image Resizing" by Shai Avidan and Ariel Shamir. The idea is to be able to shrink an image (either horizontally or vertically) to a given dimension without deforming the objects in the image. The algorithm works in the folowing way:

To shrink the image n pixels in the horizontal direction
- Filter the image with a gaussian blur
- Compute the partial derivative in the horizontal direction using a convolution between the image and the kernel = [-1 1]
- Take the absolute value of the derivatives. This is our energy function
- Using dynamic programming find the seam with less energy
- Remove this seam from the image
- repeat the last 5 steps n times

To shrink in the vertical direction the image is transposed, the same algorithm is applied and the image is transposed again.

Here the result in sample images. First is the original image and then the image after resizing.



picture from http://www.wirednewyork.com/landmarks/esb/default.htm

picture by majeczka_majeczka's flickr user

picture by majeczka_majeczka's flickr user

picture from http://www.destination360.com/europe/france/eiffel-tower.php


And some images where the algorithm didn't work very well.


picture from Alexis Wenski-Roberts/Image Lab

picture from http://nhs.needham.k12.ma.us/cur/sintros2/RD_JI/jirdp2.html

picture from http://www.ganeandmarshall.co.uk/americas/peru/machu_picchu.html

picture from http://blog.anent.in/

picture from http://www.destination360.com/asia/china/great-wall-of-china.php

picture from Apollo 17