CS 194-26: Final Project

Seam Carving and Fake Miniatures

Kimberly Zai

Seam Carving Overview

For this project, I learned how to shrink images by either width or height, trying to preserve the important, regions of interest in the photo. The idea was first calculating the importance of each pixel using an energy function. As mentioned in Shai Avidan and Ariel Shamir's paper Seam Carving for Content-Aware Image Resizing. I used the energy function e1 to calculate this importance. According to this function, the energy of a pixel is the sum of the absolute value of the x gradient and the absolute value of the y gradient at that pixel.

Then, I used dynamic programming to calculate the lowest-importance/least-energy vertical seam, where this seam consists of exactly one pixel from each row of the image. Then, I removed that seam from the image. By repeating this process until the image has shrunk to the desired dimension, I was able to remove the less important parts of the image and preserve the important content. By removing vertical seams, I was able to shrink the image's width. The process for removing horizontal seams just involved transposing the image before putting it through the same process of vertical seam removal, and then transposing the image again at the end.

What I Learned

I learned that the pictures you choose can really matter with seam carving, and you want to avoid either pictures or textured patterns because the missing seams really reveal these flaws.

Vertical Seam Carving

Original
Seam Carved
Original
Seam Carved
Original
Buildings: Seam Carved

Horizontal Seam Carving

Original
Seam Carved
Original
Seam Carved
Original
Seam Carved

Failures

Seam Carved
Original
Seam Carved
Original
Seam Carved

Fake Miniatures

For this project, I learned how to make an image appear to be a miniature scene. This involved four steps. First, you select two points, and the rectangle between them will be the fake DOF where the image will be in focus. Then, I increasingly blurred the image around the focus plane to simulate the depth of field effect. This involved first directly copying over the pixels from the original image in the focus plane. Then, for pixels within a certain distance from the focus plane, I used the pixels at that point which were applied with a gaussian filter of sigma 1 at repeated number of times based on that distance. The farther away it was, the more filters that would be applied.

Original
Mini
Original
Mini
Original
Mini/figcaption>
Original
Mini
Original
Mini