seam carving

Tony Zhao, CS 194-26 Spring 2020

energy

We'll have to figure out how to resize images while keeping the image as intact as possible. We follow the general algorithm proposed in "Seam Carving for Content-Aware Image Resizing" by Avidan et al.

The first step is establishing an energy function, where each pixel's importance is calculated. We do this simply enough by simple finding the delta between a pixel's left and right neighbors image values (dx) and also the delta between the top and bottom neighbor (dy). In the literal edge case, we simply use the delta between the target pixel and the neighbor. We assign the energy value of

$$ e(p) = dx(p)^2 + dy(p)^2 $$

castle.jpg (original)

castle.jpg (energy)

camera.jpg (orignal)

camera.jpg (energy)

seams easy

Now that we have an energy mapping, we just need to detect the minimum seams. For that we apply dynamic programming!

castle.jpg (energy)

castle.jpg (vertical seam)

camera.jpg (energy)

camera.jpg (horizontal seam)

carved up images

Now we got our algorithm down, let's carve up some photos. Some of them turned out well, some of them not so much. I didn't learn anything too novel in this project, especially since I've done seam carving in a CS61b project. But nevertheless, it was fun to revisit dynamic programming to detect minimum seams.

camera.jpg

carved

castle.jpg

carved

Photo by Fezbot2000

carved

carved

Photo by Omid Armin

carved

Photo by Charles Black

carved

carved

carved

Photo by Clay Banks

carved