Seam carving
From Wikipedia, the free encyclopedia
Seam carving is an image resizing algorithm developed by Shai Avidan and Ariel Shamir. This algorithm alters the dimensions of an image not by scaling or cropping, but rather by intelligently removing pixels from (or adding pixels to) the image that carry little importance.
The importance of a pixel is generally measured by its contrast when compared with its neighbor pixels, but other measures may be used. Additionally, it's possible to define (or autodetect) areas of high importance (faces, buildings, etc.) in which pixels may not be deleted, and conversely, areas of zero importance which should be removed first. From this information, the algorithm detects seams (continuous lines of pixels joining opposite edges of the image) which have the lowest importance, and deletes those. This shrinks the image by one horizontal or vertical line, depending on which direction the seam ran.
Seam carving can also be run in reverse by adding (interpolated) pixels along the lowest energy seam.
With this technique, it's now possible to scale pictures by a large amount, while still retaining details. In normal Image scaling, scale factors greater than 2 or less than 0.5 usually result in visible image quality degradation.
[edit] Image shrinking procedure
- Make an energy map of the image. (Areas of high energy have high importance, typically meaning detail or significance in the image.)
- Find the connected line of pixels (seam) with the least energy out of all possible lines of pixels.
- Remove this seam
- Repeat
[edit] External links
- Seam carving for content-aware image resizing
- YouTube demo of seam carving
- Dr. Ariel Shamir Home Page
- Seamstress library and Arachne demo program
- A fast implementation in Ocaml
- Rsizr - a web-based flash implementation
- A detailed tutorial and a Python implementation
- A Linux/Windows software using seam carving implementation, Liquid resize
- SEAMonster - a .NET-based implementation of seam carving
- A C++ multi-threaded open-source library: CAIR
- A cross-platform open source stand alone GUI based on CAIR
- Resizor - A freeware GUI-based stand alone program for Windows
- Seam carving for content aware image resizing: MATLAB implementation & tutorial

