CS194-26 Fall 2017 Final Project
Betty Chang

Final Project

Seam Carving

Lowest Energy Seam

The goal of this project is to use content-aware image resizing to shrink images to the desired dimensions. To do this, we must identify the lowest energy seam traveling in a certain direction, and remove that seam. That way, we can preserve the important parts of the image while cutting out parts of the background.

To find the lowest energy seam, we first define an energy function that would assign an energy value to every pixel. The energy function I used was the gradient of the pixel in each direction. Then, we use the following dynamic programming relation to find the total energy of a seam (either vertically or horizontally):

After calculating the total energy of each seam, we identify the seam with the lowest total energy, and remove it from the image. We repeat this procedure until we reach our desired dimensions.

Original

200 Vertical Seams Removed

Original

200 Horizontal Seams Removed

Original

200 Vertical Seams Removed

Original

150 Horizontal Seams Removed

Original

200 Vertical Seams Removed

300 Vertical Seams Removed

Original

150 Horizontal Seams Removed

Original

100 Horizontal Seams and 200 Vertical Seams Removed

Failed Examples

Some examples did not work out as well as the ones above, mainly because seam carving does not work well with faces or objects with detailed shapes or features.

Original

100 Vertical Seams Removed

Original

150 Horizontal Seams Removed

Original

100 Horizontal Seams Removed

200 Horizontal Seams Removed

Original

150 Vertical Seams Removed

Fake Miniatures

Tilt Shifting

We create the tilt shift effect by first specifying the focus area. The user can select the upper and lower bound of the focus area, and from that we create a rectangular mask. We then make a Gaussian stack of the original image, and a Gaussian stack of the mask, using the mask stack to determine how blurry each pixel of the output image is. The output image would then have the focus area in focus, and the areas surrounding it increasingly blurred. This creates the fake miniature effect that we're looking for:

Original Image

Mask

Output Image

New York City

Mini NYC

Freeway

Mini Freeway

Dodger Stadium

Mini Dodger Stadium

Sydney Opera House

Mini Sydney Opera House

Sushi

Mini Sushi

Bells & Whistles: Complex DOF Regions

To have complex DOF regions, we need to account for masks that are not horizontal and rectangular. We define the masks manually, then perform the same blurring procedure as above to create the output images. As we can see, these look much better for some input images:

Sydney Opera House

Mask

Mini Sydney Opera House

Sushi

Mask

Mini Sushi

Dim Sum

Mask

Mini Dim Sum

Photography

All images used in this project are either original or found online with permission to distribute.