To avoid any potential confusion, this is a personal, spare-time project that has nothing to do with the cool Seadragon technology.
Before you read my post, you should watch the short 4 1/2 minute video that demonstrates an image resizing technique called seam carving. The technique was presented at this year's SIGGRAPH 2007 conference by Shai Avidan and Ariel Shamir. If you want to know all of the details, check out the paper they presented called Seam Carving for Content-Aware Image Resizing (20MB PDF). Shai and Ariel outline a relatively simple algorithm for finding a "seam" of pixels that is least likely to be missed when it's removed from an image. The algorithm looks for connected pixels of low energy, where energy refers to a measure of visual detail. By iterating the algorithm, an image can be resized while maintaining its general structure. Unlike a typical stretch operation in your favorite graphics application, the seam carving technique resists squashing or distorting the image.
When I first saw their video, I thought it was magic. Not only do they demonstrate resizing, but they also show how their algorithm can easily remove specific content (like a person or object) from a scene. It's easy to imagine how images can be resized using this technique for display on smaller devices like a cell phone. In their paper, Shai and Ariel briefly describe a method that would allow an image format with extended seam carving data to easily resize on-the-fly. Very cool.
Inspired by their work, I thought I'd play around with the algorithm and methods in my spare time. So, over the course of the past week or so, I've put together a .NET-based implementation of seam carving that I affectionately call SEAMonster. The code has evolved from a very simple prototype to something a bit more robust. As these things go, the architecture is a bit shaky at the moment, but it does work. The early version of the application can only open JPG files, doesn't support image expansion, and the user interface is pretty minimal. However, it's far enough along that someone might find it interesting.
If you'd like to take it for a spin, download SEAMonster_0.1.zip (63KB). The application requires the Microsoft .NET Framework Version 2.0 if you don't already have it installed on your machine. In lieu of documentation, I encourage you to watch the 8 minute video introduction I recorded to quickly get up-to-speed (note that you may need to download the TechSmith Screen Capture Codec to properly view this video).
When I have the code under control, I plan to upload the project to CodePlex so that the developer community can contribute. All of the image manipulation functionality is encapsulated in a DLL, so it should be usable in most scenarios. There is a lot of opportunity for improvement and optimization in these algorithms, and I expect a lot of innovation to happen over the next few months. It should be fun to watch.
Here are some other seam carving resources that you may find interesting:
If you have any comments about this early version of SEAMonster, or if you have suggestions for the version I plan to release on CodePlex, please leave feedback (or contact me directly).
Would love to see this feature somehow integrated into Live Gallery.
I've used the flash based rsizr (or whatever you call it) and it seemed to work in much the same way.
Maybe the algorithm is the perfect opportunity to work with the PFX framework.
Hi thanks for providing helpful resources about seam carving. I was able to implement my own version of the algorithm in MATLAB with a GUI and complete documentation so that it may be helpful for people trying to understand the algorithm. My code and tutorial can be downloaded at:
Wouldn't this be nice if we could implement it in Silverlight since it's so CPU intensive?
@pbz: I had originally wanted to implement this using Silverlight, but there is no way to directly manipulate the individual pixels of a bitmap image. Since the algorithm depends on that feature, I had to use another method.
Maybe this should go to my photo blog, but since it has an interesting software development aspect, let's...
Hi there Mike, I'm very interested on this Seam Carving's Algorithm.
I'm currently doing a research about this, and this research is for my study on IT.
But I still don't get the big picture on how this "Seam Carving" technique could be implemented into something big ?
Please email me @ aditpnyu[at]gmail[dot]com if you have some advised on this.
I would appreciate your help