Programming with
Data Structures and Algorithms

Seam Carving Part 2

At this point, you should have already written an efficient seam carving program. For this assignment, you will reimplement seam carving using Java. Take a moment to remind yourself of the assignment here.

Implement the following method:

Your solution should be reasonably efficient (do not use an exponential-time algorithm). If you cannot carve 10 seams in a couple minutes from the test images we provide, you should rethink your implementation.

Java has a color class you will want to use, and there is an easy to way to get a Color from an image pixel. For example to get the color of the pixel at (x,y):

An easy way to create a new image to simply create a BufferedImage and then set the RGB value of its pixels:

Your program should be run with three arguments, which will be supplied to your main method. The first argument will be the path of the input image, the second argument will be the path to which the output image is saved, and the third will be the number of seams to be carved. Once again, use the images provided in the previous assignment for testing.

What to turn in:


Your analysis must be in a pdf file on Letter-sized paper. Mathematical content must be formatted appropriately. Please, no Arial.