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:
BufferedImage carveSeams(BufferedImage, int)
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):
File file = new File("image.jpg");
inImg = ImageIO.read(file);
Color c = new Color (img.getRGB(x, y));
An easy way to create a new image to simply create a BufferedImage and then set the RGB value of its pixels:
BufferedImage outImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); outImg.setRGB(x, y, color.getRGB()); File outputfile = new File("saved." + fileExtension); ImageIO.write(outImg, fileExtension, outputfile);
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.
seam_carving.java, with a main method containing your solution.
readme.pdf, containing short descriptions of your seam carving algorithm and any optimizations you used.
Your analysis must be in a