CS129 / Project 3 / Seam Carving

Seam carving is done by first calculating the gradients by using sobel filters on each color channel, and summing up the three channel gradients. This gives the energy function for the image, where high energy is represented by high gradient values.

Red Green Blue Energy Function

Then dynamic programming is used to find the best connected seam to remove with the minimum energy.
This is the cumulative energy table created by the algorithm for wyeth.jpg:

Results

I scaled wyeth.jpg in multiple ways. The bottom part of her dressed is removed in vertical seams due to the color similar to the grass. The clear separation curves between the two kinds of fields isn't maintained clearly in any of the cut images.

These results have both vertical and horizontal seams removed, so the scaled image does not seem as unrealistic as they would for images only scaled along one dimension.

Original Scaled Seam Carved

 

Failure cases

If trying to remove seams on an image which is filled with high frequences, then the result will be inevitably unsuccessful, since the cost of removing the minimum seam is very high. This is evident in the Dali image above. Taking further seams out of the landscape photo also causes the algorithm to start removing high cost seams.

Another failure case is when there's a gradual change in color or lighting. Seams tend to come from the same low energy area, and energy introduced by the removal is not considered in the forward energy algorithm.