CS 194-26

Seam Carving

Rosa Choe & Marisa Wong

Overview

When we want to resize an image, we have several options – rescaling, cropping. Rescaling allows us to preserve the aspect ratio as well as relative information about the image (we don't cut anything out), while cropping allows us to reshape the image by cutting out sections we no longer want. What if we want to reshape the image and cut out redundant sections, but we don't want to simply cut away the edges of the image? Seam carving allows us to resize the image in a content-aware way, slicing out pixels that contribute less to the detail or information given by the image.

Method

The first step of any seam carving algorithm is defining an energy function, basically a function that maps pixels to their level of importance. For our energy function we used a variation of the dual gradient energy function, which basically takes the difference in pixel values for each channel between the x-neighbor and the y-neighbor and computes the sum of squares. This is basically edge detection, so pixels that are along an edge will have higher energy and will be preserved compared to pixels that are not along an edge.

Results

Original Image Cropped Image
Vertical
House
Lake
Forest
Horizontal
Campus
Beach
Field
Failure
Mona Lisa
Campanile

We learned that seam-carving does not fare well for faces. Mona Lisa looks like a pencil.