iRead, iLearn, iWrite. Hence, iBlog.

For Indian Military, Nuclear & Space matters, visit:

Thursday, October 30, 2008

Seam carving pictures to remove unwanted elements

Recently while using a friend’s computer, I came across an image editing software that uses the Seam Carving technique to  resize images. Played around with it a bit and have now started getting some fairly decent results.

Before Seam carving

Original picture

(1604x2137)

After Seam carving

After Seam Carving

(1208x1616)

 (Click on the thumbnail to see the actual picture)

Resizing a picture by normal methods would mean that all elements in the picture would get resized – either all enlarged or all shrunk. However using Seam Carving method you can specify which part of the picture you want resized and which part you want to remain untouched.

Resizing with Seam Carving

As can be seen while resizing, the aircrafts in the pictures have remained untouched. Only the space between the aircrafts was removed with the Seam Carving method.

This method proved to be especially helpful to in using some earlier unusable pictures as wallpapers.

Original picture

(1)

Cropping without Seam Carving

(2)

Cropping after Seam carving

(3)

(Click on the thumbnails to view the bigger picture)

As you can see in the thumbnails above, when I crop the original picture (1) using aspect ratio 4:3, in the resulting image I get (2) the aircraft is not completely shown in the picture. So I apply Seam Carving to the picture to remove some space between the aircrafts and once that is complete, I crop the image. The resulting image (3) has the aircrafts shown completely and prominently.

There are a few terms you will have to deal with while applying this technique – Seams, Energy Lines, edges etc

Used Seam Carving GUI to apply Seam Carving to the pictures. Will try it in GIMP using the Liquid Rescale plugin later.

The October issue of IC-CHIP magazine also carries an article on Seam Carving. You might want to go though it if you living in India.

Some additional Resources

Youtube video about Seam Carving

Dr. Ariel Shamir’s Homepage

Shai Avidan’s website

All images courtesy af.mil

Godspeed