This goal of this project is to take an image and resize (retarget) it by removing some number of rows or columns. In order to preserve the most important elements of the photo, the rows and columns are removed along low-energy seams. I used a hybrid energy model consisting of a entropy filter and a custom neighbor difference filter. Then I wrote a dynamic programming algorithm to find the seams with the lowest total energy. For more information about this project, please see the project page.
Click any image to see the full-size version.
The code does not behave as expected in certain images with relatively energetic backgrounds along with people, especially if those people are wearing solid-colored or uniformly-colored clothing. Since the people are less energetic than the background, the people tend to be removed first, with the background preserved around them. However, my code also tries to preserve significant edges of the images. So for large numbers of rows or columns removed, you end up with very very skinny edges of the people highlighted obtrusively in the image with little or no body filling in the outline of edges. The results are somewhat bizarre, as show below. In the last example, the person seems to be enveloped as if he is being steadily sucked into the menacing fluffiness of the stuffed animals behind, never to be seen again. And he clearly isn't energetic enough to escape, as even the background has much more energy than he does.
I wrote an algorithm for visualizing a seam or a set of seams chosen by the seam carving algorithm. Many samples with two chosen seams are shown above.
When run with multiple seams, this allows you to see approximately where seams might be carved out. In order to simplify the algorithm, the image size is not reduced during this process, so the seams become less accurate over time, but I found them to be a very helpful tool for visualizing where the seams were carved.
When we compare the generated visualizations to the expected behavior, we can conclude that the algorithm seams legit!