Implementation

My approach uses a simple energy function which does the following: compute the difference in RGB values for the given pixel and each of its neighboring pixels (8-point connectivity), and then average them. The R, G, and B channels are weighted equally for measuring difference.

The below image displays the result of this energy function contrasted with the original image - the darker the spot the lower the energy. These spots clearly correlate with the gradient differences.


Next, we run the simple dynamic programming algorithm desribed in the paper across to image to find all possible 8-connectivity paths (seams) and their corresponding summed energy. We remove the minimal energy seam and repeat until the image is resized to our specified width/height.


This implementation works well on images with nice continuous swaths of mostly solid colors or gradual gradients. Any image without these qualities tend to come out rather funny looking. Improvements on those sorts of images would likely require a different energy function.

Awesome Images

(Flickr source)
(Flickr source)
(Flickr source)
(Flickr source)
(Flickr source)
(Flickr source)

Not so Awesome Images

(Flickr source)
(Flickr source)
(Flickr source)

These Images are Okay I Guess

(Flickr source)
(Flickr source)
(Flickr source)