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:
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:
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:
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.