[Introduction and News]   [Background]   [Download]    [Sourceforge Project Page]   [Links]
[DIRT]    [Forum]    [Examples]    [HowTos]    [Documentation/FAQ]    [Screenshots]   

Digital Image Resizer Toy

Download DIRT here.

WHAT IS IT?

The Digital Image Resizer Toy (codename: DIRT) is an implementation of Shai Avidan and Ariel Shamir's "Seam Carving for Content Aware Image Resizing" algorithms. Their algorithms have been made famous via a video labelled "Advanced Image Resizing". In case you haven't seen it, I recommend you watch it before reading any further.



Video Download links (all the same video)

If you'd like to read the paper on the subject, it can be found at one of the author's homepages - here.



I came across the video using StumbleUpon, and after clicking "I like it", I was presented with the same video again a number of times. I was so fascinated with how it worked, each time I ended up watching the video in it's entirety. Eventually I was curious enough to get a hold of the paper describing the algorithms and decided to code a program so I could try this very-cool technique out for myself.

The thing that had initially struck me about the algorithm is it's similarity to my steganography algorithms. It uses filters much like FilterFirst and BattleSteg do. I already had half the code I needed to get the seam carving working, all I needed was the dynamic algorithm to seam carve. The actual algorithm for removing seams is summarised in a single formula in the paper, and is elegant with it's simplicity. DIRT is the result of my efforts to 'play with' the seam carving algorithm. I have released it as open-source so that other people can enjoy playing with it as much as I do, and can learn further about the algorithm.

So without further ado, you can download DIRT here.


DIRT is presented in a zip file, which contains a jar file (dirt itself) and a number of text files that are the usual licensing, changelogs and release notes. To run DIRT you'll need Java 1.5 (only the JRE) which you can find here (4th one down). To run it, just double click the dirt.jar file. If you have issues with that (WinRAR can sometimes open jar files instead of java), just double click the bat file (for Windows). Instructions for other OS's can be found in the README file in the zip file.



HOW DOES IT WORK?

The program is pretty much self explanatory, you just load in an image, then use the arrow keys on your keyboard to increase or decrease the width and height of the image. The window with the picture must be the active window on screen for pressing the arrow keys to work. You can even brush the image with preserve (P) and Erase (E) brushes, so the algorithm targets (or avoids) particular areas of the image. The "N" brush erases other brush strokes, and the "C" button clears ALL brush strokes from the image.

The decrease size algorithm is implemented as described in the paper. The increase size algorithm is almost the same, only it hacked up to try and avoid the last seams that were added (but there are no guarantees it will). The algorithm to enlarge areas of the image (section 4.4 of the paper) is not implemented in DIRT. The Sobel algorithm is a gradient magnitude function, and the Prewitt filter is a less strict gradient magnitude algorithm. The Laplace algorithm is used to find noisy areas of the image, so it is also an edge detector.

WARNING: How fast the program works depends on the size of the image and the speed of your computer. So try with small images first. The "Erase" and "Retarget" buttons are not implemented how they are described in the paper, DIRT simply alternates between calling the decrease/increase functions for width and height until the image is resized, and they take a LONG TIME to finish with the image.



EXAMPLES

Here is an example of the decrease/erase algorithm in action. We start out with plane.jpg and decide to remove the plane from the picture.

So we highlight the plane using the erase brush, to get the following picture.

Finally we hit "Erase" and wait (we could also manually resize using the arrow keys), and the following picture is obtained.

The end result is a picture without the plane, and no obvious editing of the image. The algorithm works better with images with no diagonal lines on the background (as they don't match up when a seam is removed). Grass, sky, sand and forestry images seem to work best.

Here is an example of the preserve working alongside erase with a manual resize. We start off with a picture of some bears that are far apart.

We want to preserve the bears and erase the flower, the bird and the trash on the grass, so the appropriate areas are highlighted.

Then the picture is first moved up so the bears are all on the same level, then across to put them all together.

Finally we get a smaller pictures of all the bears together, the editing is a little more obvious this time because we have removed a lot of the picture, but the results are still pretty good. You can download any of these pictures and try it for yourself if you don't believe this is real. (Just right click on the picture and click "Save As").

If you have any questions about DIRT or DIIT, please feel free to email me at kah18 |at| users.sourceforge.net


 

 

(c) K. Hempstalk, University of Waikato, 2007