Content Aware Image Resizing: GPL Implementation
August 30, 2007 on 1:46 pm | In Dev, General, Imaging, Java, Releases |
Just for the proof of concept I’ve implemented parts of the Content Aware Image Resizing algorithm (presented by Avidan, S. & Shamir, A.) shown here (covered also on Slashdot, Techcrunch, …) in Java (GPL). Currently image size can only be reduced.
The images on the left show results from the implementation. The source as well as the binaries can be downloaded here:
![]()
Source & Binaries (Java 1.6 needed, ~30k): SeamCarving.tar.bz2SeamCarving.zipWindows Executable (Java 1.6 needed, ~200k): SeamCarving-Win-Bin.zip- The most current implementation can be found here.
I’ve furthermore put up a GUI tool for loading and ‘carving’ images. It allows to mark areas for retaining (red brush) as well as for removal (green brush). The screenshot shows the application with area already colored. Download is here:
- Source & Binaries (Java 1.6 needed, ~65k): ImageCarving-GUI.zip
9 Comments »
RSS feed for comments on this post. TrackBack URI
Leave a comment
© 2004-2007 by Mathias Lux
>> Contents of this page are licensed under the CreativeCommons Attribution 2.5 license <<
A few comments re: the GUI app
1) Opening a large photo does not result in scrollbars when needed, making it impossible to mark needed/unwanted areas that are off-screen
2) After specifying a height and width smaller than the current photo, and clicking the Resize button, my CPU went to 100% for a short while, but once that was complete, nothing changed in the GUI. Is there something special I have to do to see / use the resulting resized image?
Comment by Smite — September 2, 2007 #
Yeah I know, unfortunately I just did this for small images (e.g. 640×480). With bigger ones one has a performance problem. As for the scroll bars: I can do this, sure. I’ll update and blog again.
Comment by Mathias Lux — September 3, 2007 #
[...] una noticia relativa a la implementación GPL del cambio de tamaño de una imagen “sin pérdida” de calidad, he visto una entrada sobre la adicción al blogging. En dicha entrada se enlaza a una dirección [...]
Pingback by Ahijado’s blog » Blog Archive » Adicto al “blogging”: 78% — September 3, 2007 #
I’ve just tried you GUI tool, and I have found that, at least on my computer, it seems to produce artifacts in the image. I, too, have implemented the algorithm (in C++ though), and my results do not have those diagonal seam patterns. I think at some point my results looked similar though, but I can’t really remember what the reason was. I suspect it may have something to do with the seam cost map.
Here is a screen shot of our programs running side by side, both times resizing the identical coastline image from the paper to 250×250 pixels (I made a screen shot of the original image from the youtube video so I could compare my results):
http://img409.imageshack.us/img409/6797/unbenanntxs5.png
Great work though, it’s cool to see someone is implementing the marking part of the paper. Keep it up, I’m looking forward to seeing what you come up with
Comment by Peter — September 5, 2007 #
hmm .. I think I know what the reason for these artifacts is: The selection of the seam for backtracking is the bad one in my opinion. I always start from left and take the first minimum value I encounter. I should take a random one.
I’ll try to fix this along with the sliders
thx for the report!
Comment by Mathias Lux — September 5, 2007 #
Hey Mathias,
I don’t think that’s a problem, my code always takes the first one, too. I suspect the cause of those artifacts is that you do not recompute the seam cost map (called M in the paper) after each iteration of the algorithm. The paper is not very clear in that section, but I think you have to update the energy map e (since the derivatives change for the pixels near the seam you just removed) and then recompute the seam cost map. I could be wrong, though…
Comment by Peter — September 5, 2007 #
I just double re-checked (even debugged) and M is recalculated each time. Also the gradient image is updated each iteration. I think I’m stuck right here
Comment by Mathias Lux — September 6, 2007 #
I’ve resolved this one
check out the new v3 …
Comment by Mathias Lux — September 25, 2007 #
Thanks for the code. The results that I’ve got were ok, not what I was expecting, but still ok. I am used to a resizing tool I found at reshade.com and the results I got with it were the best compared to other tools so I guess I got used to compare it to those results. But averaging the result I got on my computer they were ok, I’m just waiting for the better version. Anyway thanks for sharing.
Comment by Delia — May 1, 2008 #