Wednesday, August 29, 2007

Content Aware Image Resizing - A Seam Carving GUI

I built a simple Seam Carving GUI as a GUI front end to the implementation of the Seam Carving algorithm by Andy Owen[1].

I ran into Andy's comment to the Slashdot article about Content-Aware Image Resizing[2] and decided his late night hack was worth looking into. And hey, it worked! After a few days of seeing the impressive demonstration video about the SIGGRAPH paper on seam carving I found myself going back to Andy's implementation to manually grind some images through his C code and began thinking, lets get some GUI going on here!

So there you have it, two nights of feverish coding later (one with a slightly hindering amount of wine consumed during a MythBusters viewing session) and I have something to ship.

Enjoy, if you have any questions or suffer from the undeniable urge to lavishly complement this quick hack of a GUI, or more likely would like bellow your complaints about something your getting for free, you can reach me at gaberudy+seamcarving at gmail.com

TODO:
  • Copy and Paste
  • Drag and Drop
  • Do any sort or optimization of Andy's image stuff
  • Do the bit where you mark parts of the image to preserve or make go away
  • Read the paper and make it really work!

DOWNLOAD:
  • Build instructions and screenshots: here

[1] Andy is the nicest (and only) Australian I've ever met on the internet, I got his permission to do a GUI around his resizing code and he was very supportive, even adding in a feature or two for the cause.

[2] His was actually one of two comments that had links to quickly written code, but it was plain to see that Andy's was the proper implementation to follow up on as it received a (+5 Interesting) vs. the(+4 Interesting). Tsk tsk, not to mention the other link was cold dead.

Update: The latest version is no longer based on Andy's implementation but CAIR. See the seam-carving-gui project page for more.

18 comments:

Olivier said...

Thank you for this nice implementation! Here's an example using it:

http://www.olussier.com/photos/pagoda.jpg

The left part is the original picture, the center part is the seam carved version and the right part is a normal resize.

Gabe said...

Thanks Olivier,
I'm glad you liked it!

Smite said...

Awesome, if terribly slow on large images.

Can we expect any of the following?
1) jpg support
2) multi-threaded resizing (for multi-core systems)
3) The whole importance-painting thing shown at the end of the SIGGRAPH video

Even without those, great job! This should be very cool to play with.

Anonymous said...

I'm trying to compile it on OS X (with QT4 installed), but there doesn't appear to be a makefile in the directory, even after running qmake?

Anonymous said...

OK, it actually generated an xcode project file instead, but building it fails with 22 errors.

Gabe said...

smite: Jpg support is trivial, as it just requires I package the Qt JPEG codec plugin with the application, a simple oversight in my first hurried ship of the project.

It is indeed slow and there are lots of speed optimizations I can think of before warranting the complexity of multi-threading, this is on my list of things to do right after your third item. Apparently somebody did a Java version that includes painting the picture red and green to indicate save and delete regions, so naturally I have to try to one up that with proper masks for these regions.

anonymous: Mac OS X support should be just a matter of getting the right build settings, the C code is gnu99 C and it may take some build setting adjustments get that to compile. I'll look at it later on our Mac at work sometime, maybe even put up a Mac universal binary if all goes well.

fotocomics said...

I'm very happy for the gui, thank to do it and so quickly

I reported the news here quoting your blog
http://www.gimptalk.com/forum/topic/Any-Hope-For-A-Plugin-Doing-This-24209-last.html#186522

But ... any hope to have it as Gimp plugin? will be such a handy tool integrated with gimp workflow

fotocomics said...

OOPSS sorry the link was cutted and something wrong with tags

ii try again as plain text
http://www.gimptalk.com/forum/topic/
Any-Hope-For-A-Plugin-Doing-This-
24209-last.html#186522

Nathan deGargoyle said...

Thanks for the coding Gabe (and thanks fc for bringing it to my attention) but please sort out the jpg loading. It's a bind having to convert my pics to png to make this work.

Anonymous said...

This is really nice, it is a bit slow but the results are just nice. I know that people are suggesting some kind of gimp plugin.There is already a gimp plugin the liquid gimp plugin, but Gabe you might want to thing about making a Krita pluging since you use qt already.

Deliaresizer said...

Thanks for the implementation. I’ve got only one remark too make it worked a little bit slow when I’ve tried it on large images…but anyway that’s okay because I’ll stick with reshade for large images. I’m highly satisfied with their quality and accuracy.

Anonymous said...

How does this perform compared to Liquid Resize 0.67 (the last public release before Adobe bought it)?

Valencia said...

Good for people to know.

Gabe said...

I haven't used LiquidResize, maybe somebody can compare performance and post response. We use multiple threads to do computation, which should improve performance significantly on multi-core boxes.

Mark said...

The video showed resizing the photos by dragging the window handles - any chance that can be put in instead of having to type in a window size?

Also: the geek in me :) would like to see the lightning like lines zapping across the picture as it deletes the pixels. Is it possible to see that with an option?

Anonymous said...

I found this site using [url=http://google.com]google.com[/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!

Sorry for offtopic

Chuck said...
This comment has been removed by a blog administrator.
Ɓukasz said...

Hello

Would it be possible to create Photoshop-compatible plugin?