Seam carving

Seam carving
Original image
Same image reduced in width using scaling...
...cropping...
...and seam carving

Seam carving (also known as image retargeting, content-aware image resizing, content-aware scaling, liquid resizing, or liquid rescaling), is an algorithm for image resizing, developed by Shai Avidan, of Mitsubishi Electric Research Labs (MERL), and Ariel Shamir, of the Interdisciplinary Center and MERL. It functions by establishing a number of seams (paths of least importance) in an image and automatically removes seams to reduce image size or inserts seams to extend it. Seam carving also allows manually defining areas in which pixels may not be modified, and features the ability to remove whole objects from photographs. The purpose of the algorithm is to display images without distortion on various media (cell phones, PDAs) using document standards, like HTML, that already support dynamic changes in page layout and text, but not images.[1]

Contents

Seams

Seams can be either vertical or horizontal. A vertical seam is a path of pixels connected from top to bottom in an image with one pixel in each row[1]. A horizontal seam is similar with the exception of the connection being from left to right. The importance/energy function values a pixel by measuring its contrast with its neighbor pixels.

Computing Seams

Computing the seam consists of finding the path of minimum cost from one end of the image to another. This can be done via Dijkstra's algorithm, dynamic programming, or graph cuts [1].

Dynamic Programing

Dynamic programming is a programming method that stores the results of sub-calculations in order to simplify calculating a more complex result. Dynamic programming is used in seam carving for computing seams.

If attempting to compute a vertical seam (path) of lowest energy, for each pixel in a row we compute the energy of the current pixel plus the energy of one of the three possible pixels above it.

This is better described by this image:

DynamicProgrammingLeastEnergyPathA
Each square represents a pixel, with the top-left value in red representing the energy value of that said pixel. The value in black represents the cumulative sum of energies leading up to and including that pixel.

The first row has no rows above it, so the sum (black) is just the energy value of the current pixel (red).

The second row, if we look at the second pixel for example, we see its energy value is a 2 (red). If we look above it, it has a choice of either 1, 4, or 3 (black). Since 1 is the minimum number of the three values, we ignore the other two and set the sum of the pixel to its energy value which is 2 (red) plus 1 (black).

After the above operation is carried out for every pixel in the second row, we go to the third row:

DynamicProgrammingLeastEnergyPathB

We repeat the process in row two in row three to end up with the final cumultive sums for the seams/paths. The lowest value or values are the seams with the lowest energy, which would be in this example the seams with '5' in the last row.

To trace the seam/path, work from the last row and follow the green arrows:

DynamicProgrammingLeastEnergyPathC

Algorithm

1) We start with an image such as:

BroadwayTowerSeamCarvingA


2) We then calculate the weight/density/energy of each pixel. This can be done by various algorithms: gradient magnitude, entropy, visual saliency, eye-gaze movement[1]. Although gradient magnitude gives 'satisfactory results.'

BroadwayTowerSeamCarvingB


3) After we have the energy of the image, we generate a list of seams. Seams are ranked by energy, with low energy seams being of least importance to the content of the image. We can choose to calculate seams via the dynamic programming approach.

Seams shown with the energy function:

BroadwayTowerSeamCarvingC

Seams shown with the original image:

BroadwayTowerSeamCarvingD


4) We then remove the seams from the image, reducing the size of the image as a result:

BroadwayTowerSeamCarvingE

The recalculated energy function of the image would be:

BroadwayTowerSeamCarvingF

Issues

  1. The algorithm may need user provided information to reduce errors. This can consist of painting the regions which are to be preserved. With human faces it is possible to use face detection.
  2. Sometimes the algorithm by removing a low energy seam may end up inadvertently creating a seam of higher energy. The solution to this is to simulate a removal of a seam, and then check the energy delta to see if the energy increases. If it does, prefer other seams instead.[2]

Implementations

Adobe Systems acquired a non-exclusive license to seam carving technology from MERL[3], and implemented it as a feature in Photoshop CS4, where it is called Content Aware Scaling.[4] As the license is non-exclusive, other popular computer graphics applications, among which are GIMP, digiKam, and ImageMagick, as well as some stand-alone programs, also have implementations of this technique, some of which are released as free and open source software.[5][6][7]

Improvements and extensions

  • Better energy function and application to video.[2]
  • Combine with cropping and scaling.[8]
  • Much faster removal of multiple seams[9]
  • On-demand, server-side seam carving [10]

See also

References

  1. ^ a b c d Seam Carving for Content-Aware Image Resizing. Shai Avidan, Ariel Shamir, 2007.
  2. ^ a b Improved Seam Carving for Video Retargeting. Michael Rubinstein, Ariel Shamir, Shai Avidan. SIGGRAPH 2008.
  3. ^ Mitsubishi Electric press release, Business Wire, December 16, 2008.
  4. ^ Adobe Photoshop CS4 new feature list.
  5. ^ Liquid Rescale, seam carving plug-in for GIMP
  6. ^ Announcement of inclusion in digiKam
  7. ^ Seam carving capability included in ImageMagick
  8. ^ Multi-operator Media Retargeting. Michael Rubinstein, Ariel Shamir, Shai Avidan. SIGGRAPH 2009.
  9. ^ Real-time content-aware image resizing[dead link] Science in Chine Series F: Information Sciences, 2009 SCIENCE IN CHINA PRESS.
  10. ^ On-demand, server-side seam carving based on CAIR

External links



Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Seam carving — Le Seam Carving ou recadrage intelligent, est un algorithme de redimensionnement d image développé par Shai Avidan et Ariel Shamir. Cet algorithme redimensionne, non pas par une mise à l échelle ou un recadrage classique, mais par une suppression …   Wikipédia en Français

  • Video Retargeting — (en castellano, Reescalado de Video) es el proceso de transformación mediante el cual se adaptan las dimensiones de un video existente a las de un dispositivo de reproducción cualquiera (televisión, teléfono móvil, ordenadores portátiles, etc.)… …   Wikipedia Español

  • Inhaltsabhängige Bildverzerrung — Ausgangsbild selbes Bild mit Stauchung durch Skalierung …   Deutsch Wikipedia

  • Dressmaker — For other uses see Dressmaker (disambiguation) Seamstress redirects here. For the graphics library, see Seam carving. For the film, see The Seamstress. Pierre Balmain and the actress Ruth Ford, photographed by Carl Van Vechten, 1947 A dressmaker… …   Wikipedia

  • Clone tool — This padlock is imprinted with the manufacturer’s logo. The same padl …   Wikipedia

  • Adobe Photoshop — Photoshop redirects here. For other uses, see Photoshop (disambiguation). Adobe Photoshop Adobe Photoshop CS5 x64 running on …   Wikipedia

  • Dynamic programming — For the programming paradigm, see Dynamic programming language. In mathematics and computer science, dynamic programming is a method for solving complex problems by breaking them down into simpler subproblems. It is applicable to problems… …   Wikipedia

  • Mitsuru Matsui — (松井 充, Matsui Mitsuru?, born September 16, 1961) is a Japanese cryptographer and senior researcher for Mitsubishi Electric Company. While researching error correcting codes in 1990, Matsui was inspired by Biham and Shamir s differential… …   Wikipedia

  • MISTY1 — MISTY redirects here. For other meanings, see Misty MISTY1 General Designers Matsui, Camellia, MISTY2, KASUMI Certification CRYPTREC, NESSIE Cipher detail Key sizes 128 bits …   Wikipedia

  • Mitsubishi Electric — Corporation 三菱電機株式会社 Type Corporation Traded as TYO …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”