Willy Nolan

Seam Carving

Cropping an image is typically limited to selecting rectangular portions of an image and removing them. Enlarging an image typically means stretching an image which can result in pixelation.

Seam carving, also known as "Liquid Resizing" is a technique that removes both of these limitations.

Seam carving works by finding the low-energy seams of the image and then removing vertical or horizontal (but not necessarily straight) seams from the image.

In this context low-energy seams are single-pixel wide parts of the image where there is not much change. Because the seams occur in areas where there is not much change, their removal is less likely to be noticed.

For this implementation I created a program that uses a Sobel filter to determine low-energy seams in the input image. These seams are marked with red in the featured images accompanying this post.

The technique can also be used to increase image size, essentially by working in reverse.

The idea is to identify seams that would have been removed and then insert seams in those locations as again these seams are (as with seam removal) unlikely to be noticed.

In the last series of featured images newly added seams are marked in green. The color of the added seams in the final image is calculated by averaging the color of pixels on either side of the image.

This is known as "seam insertion" and its usefulness is one reason "liquid resizing" could be a better name for this algorithm in general.

This technique has been implemented in several image editing programs including both Photoshop and Gimp.

This project implements the academic paper:

Original image

Original image

Image with seams marked

Image with seams marked

Result image

Result image

Original image

Original image

Image with seams marked

Image with seams marked

Result image

Result image

Original image

Original image

Image with seams marked

Image with seams marked

Result image

Result image