str3.me

blog about

Seam Carving

14 Sep 2007

About 3 weeks ago I saw the amazing Siggraph 2007 film from Dr. Ariel Shamir on YouTube. Immediately I downloaded the document from Shamirs webside. This takes about 5 hours download time for an about 20 MB PDF file. A lot of people was interested in Shamirs work at this time. After reading the paper I understand how Shamir realized his idea. My big problem was my ignorance about image energy functions For example, history of Gradienst (HoG) is until now a unknown algorithm for me. After some days I saw the solution from Swieskowski in the net. He explained that he using a simple colour difference algorithm for the energy picture. That was something I learned in my study. Perfect, lets start the experiment to develop a small command line tool to shrunk the width of pictures. After some hours I generate the first shrunken pictures.

Towers shrunken

The Emirates Towers in Dubai. A really easy example. Because the shrunk algorithm just needs to remove the blue sky space between the towers. After that I tried this photo shot from the Colosseum in Roma

gladiators shrunk

After that I realized that I am on the right way. Lets try a painting.

painting shrunked bad

Not bad, but here you see a problem. The face on the right picture is distorted. Dr. Shamir found a solution for that problem. He creates a mask for important areas . So I tried to do the same. I used GIMP to create the stencil picture.

painting gimp

After rerun my small tool with the stencil picture the result is a shrunken picture without face distortion.

painting shrunked good

Another example with stencil.

rocket shrunked good

The first picture is the origin, the second is shrunken by 20 pixel without a stencil picture. You see the problem with the left leg of the Fairy Dust at Chaos Communication Camp 2007. The third picture is also shrunken by 20 pixel put with the stencil picture. The fourth picture is the stencil picture.

Shamirs idea is genius and amazing easy to practise. My small hacked solution was done with C# under Linux, it took me about 3 evenings to develop this small solution. Bad is, that it is far away from realtime resizing.

comments powered by Disqus
Kai Strempel