Wednesday, September 19, 2007

Seam Carving - The Sequel

There seems to be a flurry of activity over the algorithm developed by a couple of Israeli researchers on resizing an image with minimum loss. I've written a blog on it a couple of days ago, noting the interesting results they got based on a video available on YouTube.

People were fast to implement the algorithm on flash. I've found already four versions, one by Patrick Swieskowski, another by joa, still another by Hector Yee and finally one by zero point nine. There is also a plug-in for Gimp (very cool, BTW) amd an implementation in python (no source code yet, though). As expected, the algorithm demands some computing processing but not that much. I've clocked the gimp plug-in performing a reduction on the width of an image from 1024 pixels down to 640 between 15 to 20 seconds. The flash version is slower, but still workable. With these implementations one can play a bit with different images.

The one by Patrick Swieskowski can be fed any image, something important to try out different subjects. In his blog he points out that "It's a little tricky to find photos that can be resized by a large amount with cool results". The second implementation has pretty good results with the images they've chosen (the second image is here). Hector Yee makes an interesting comment where he also tried implementing the algorithm choosing randomly the next seam to be carved, and got somewhat better results for images more geometric.

Well, then, how does it fare in the real world? Not that bad, would be the answer, but some images are better than others. The algorithm performs best for those images that have homogeneous expanses, like sky, water and snow, where it can unnoticeably suppress those expanses (or expand them) without affecting more interesting details (like a human shape). As soon the image becomes a little more complex, though, the algorithm may disturb important portions of the image. This can be seen from the first demo above, where the tree (arguably the main subject in the picture) gets purged from the photography when we try to reduce its height by more than approximately 40% (at 50% reduction it no longer draws any attention). Still, the algorithm does a good job below that level, and maybe, with a little hint of our part on the importance of the tree, it can squeeze it further keeping a good job. Also, if the subjects in the image are not that familiar (many landscape images are like that) then the processing gives better results.

On the other hand, for some images, especially those more geometric, the algorithm may perform poorly. You can see that with the following two images:

 

For those, the algorithm seems to disturb the image faster and more noticeably. But maybe folks are going to improve it. We'll see.

I'll post laster some experiments I did with the gimp plug-in.

Labels: ,

0 Comments:

Post a Comment

<< Home

eXTReMe Tracker