Subscribe to Make Magazine Today!

Ariel Shamir and Shai Avidan have presented the coolest digital image effect I have ever seen. “Seam carving” allows an image to be resized non-uniformly, so you can change the height to width ratio in the image without cropping, but also without distorting important features in the image (such as faces).

If I understood the demonstration correctly, the algorithm detects horizontal and vertical paths which span the whole image and have the least gradient magnitude along the span. When resizing an image, the pixels along these seams are stretched or removed, leaving the rest of the image untouched. Areas of an image that absolutely need to be preserved can be manually excluded, and the seam generating function will negotiate paths around those pixels.

You need to watch the video to really see this in action, but the technique can also be used to remove whole portions of an image without perceptible artifacts. Essentially, you could cut an Ex out of your old vacation photos and the rest of the image would distort itself, unnoticeably, to fill in the gap.

Seam Carving for Content-Aware Image Resizing – [via] Video: Link PDF: Link
High-res copy of the above video @ Dr. Ariel Shamir’s site – Link


9 Responses to Seam carving: content-aware image resizing

Your Thoughts?

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  1. acm has a paper on it. July 2007. looks similar to the youtube presentation.

    http://portal.acm.org/citation.cfm?id=1276377.1276390&coll=portal&dl=ACM&CFID=15151515&CFTOKEN=6184618

  2. jimmy.kl on said:

    Agreed it’s a neat effect and effortlessly accomplishedWhat I think is scary about it isn’t the ease of removing people or the likes – that’s easily accomplished (though not so fluidly) with photoshop et al. – it’s the distortion of any concept of composition which the original image had. See Nat Geo pyramids fiascoCreators of imagery spend their lives working with compositions and mastering their techniquess and now we’re going to squash and munge their images just to fit the ‘important parts’ on an iPhone?? Pssssssesh.

  3. yoyolele on said:

    A really cool explanation with illustrations is available here:
    http://yaniv.leviathanonline.com/blog/math/seam-carving/

  4. yoyolele on said:

    A very good article explaining the algorithm (with many photos) is available at http://yaniv.leviathanonline.com/blog/math/seam-carving/.

  5. a browser applet of the algorithm here.

  6. untitled1 on said:

    For those interested, I have implemented a parts of the algorithm from the paper in C++. You can download the software (currently windows only) from my site.

  7. Check out rsizr.com for a Flash-based implementation of seam carving that lets you resize images, both in height and width simultaneously, in real time.

  8. Dan Luong on said:

    Hi, I’ve implemented the seam carving algorithm in MATLAB with GUI and complete documentation and tutorial so that others new to seam carving can more easily understand the operations invloved. My source code and documentation can be found here:
    http://danluong.com/2007/12/21/seam-carving-matlab-implementation-tutorial/

  9. Shakakai on said:

    That’s really sweet. Its applicability to application development, the designer-developer work flow, and design in general is mind-boggling.

    If anyone successfully downloaded the PDF, could you post it somewhere. Looks like Dr. Shamir’s web server is getting pounded.

Related Supplies at Maker Shed