Seam Carving for content aware Photo resizing

Ever faced the problem of copying and pasting a too big photo in your Blog and seen your Blog losing its sidebar? Ever seen a picture mis morphed in a widget? Do you know how to fit one and the same picture in both a computer-, a PDA- and a cellphone screen without getting distortions? Then you will appreciate the following solution:

Recently, in a PDF paper Seam Carving for Content-Aware Image Resizing, Shai Avidan of Mitsubishi Electric Research Labs and Ariel Shamir of The Interdisciplinary Center & MERL, explain an algorithm they propose to coin Seam Carving to overcome a common problem when you want to present a picture in various ways, or more common, if you want your photo or picture resize with your document in an non destructive or non obtrusive way.

The following three pictures will show what they mean:
First the original photo:

Seam Carving Original
Original photo with indication of horizontal and vertical seams

If for one or another reason this photo is stretched without Seam Carving applied, you get the following distorted result:

Seam Carving Original Stretched without carving
Original Photo Stretched without applying Seam Carving.

If this photo is stretched after applying Seam Carving, it is still distorted, but in an unobtrusive way:

Seam Carving Original stretched with Seam Carving
Original stretched after applying Seam Carving

The diversity and versatility of display devices today imposes new demands on digital media. For instance, designers must create different alternatives for web-content and design different layouts for different devices. Moreover, HTML, as well as other standards, can
support dynamic changes of page layout and text. Nevertheless, up to date, images, although being one of the key elements in digital media, typically remain rigid in size and cannot deform to fit different layouts automatically. Other cases in which the size, or aspect ratio of an image must change, are to fit into different displays such as cell phones or PDAs, or to print on a given paper size or resolution.
Standard image scaling is not sufficient since it is oblivious to the image content and typically can be applied only uniformly. Cropping is limited since it can only remove pixels from the image periphery.
More effective resizing can only be achieved by considering the image content and not only geometric constraints.
We propose a simple image operator, we term seam-carving, that can change the size of an image by gracefully carving-out or inserting pixels in different parts of the image. Seam carving uses an energy function defining the importance of pixels. A seam is a connected path of low energy pixels crossing the image from top to bottom, or from left to right. By successively removing or inserting seams we can reduce, as well as enlarge, the size of an image
in both directions (see Figure 1). For image reduction, seam selection ensures that while preserving the image structure, we remove more of the low energy pixels and fewer of the high energy ones.
For image enlarging, the order of seam insertion ensures a balance between the original image content and the artificially inserted pixels.
These operators produce, in effect, a content-aware resizing of
images.

They also explain this principle in a very instructive video:

A quantum jump forward I would say.

PhotoLogiX

Bruno van den Elshout

Because almost all van den Elshouts living in The Hague are distant relatives, Bruno van den Elshout is likely to be one of my distant relatives. He is 30 years younger than I am – happy him – and he lives around the corner.

I had spotted his PhotoLogix Photo Blog already some time ago. Now it appears he is spreading out with his work and gradually his Blog is becoming a real Travel Photo Blog. Therefor this plug.

Why and when?

Why?

Since June 5, 2004, as a co author, I publish in the Dutch language at the Weekend Hotel Blog. Hence the date of this post far before the actual start of this blog, because actually Happy Hotelier went public on August 23, 2006. Older posts of the Weekend Hotel Blog will keep their original time stamps.

Happy Hotelier’s aim is threefold:

  • Making interesting Weekend hotel blog posts available in the English Language;
  • Addressing issues not suitable for the Weekend Hotel Blog, and
  • Having a place to publish Happy Hoteliers’ own musings and hotel reviews.

Want to know more about me? Read the About page, or the 101 Happy Hotelier Category .

Update:

More and more you need photo’s on your blog. That’s why I Googled for a picture with search term “Why” and found this funny one that Rob shared Why is there a Car?. Rob seems a fellow Dutchman.