Java PPM - FOR SOLUTION MESSAGE ME INSTANTLY
Please help write an application in Java that takes, as input, a series of similar images and outputs a new image with unwanted objects from the original series removed. The images will be provided as ppm files so all your program needs to do is edit them as text files to accomplish your goal. I have provided three images attached to this assignment: 1. tetons1.ppm 2. tetons2.ppm 3. tetons3.ppm See if you can guess which objects should be removed from these images. How do you remove the unwanted objects? Notice that the unwanted images appear in different parts of each image. This allows you to simply write a new ppm file where each RGB value will be whatever the majority of the three images above suggest. So in this case at least 2 of the files will always have the right pixel values. So how do you do this in Java? Make a class called Effects. In it go ahead and make a method called filter that takes two explicit parameters: an array of File objects and a String which will be the name of the new file. The method will then write a new file using the majority rules approach described above for each pixel RGB value. Using an array to store the File objects allows the user to provide any number of File objects to the method. So what do you turn in? Along with your ReadMe turn in two files: One called EffectsTest.java and the other called Effects.java. Your main method should be in EffectsTest.java. Have it ask the user for the file names of the input files, instantiate the corresponding File objects and put them in an array. Then instantiate an Effects object. Finally, ask the user for the output file name and use the filter method to create the new image file. Remember your application should work on any number of ppm files, not just the three provided here. Extra Credit (20 points): 1) (15 points) Add a method called "flipHorizontal" to your Effects class which will flip the picture horizontally. That is, the pixel that is on the far right end of the row ends up on the far left of the row and vice versa (remember to preserve RGB order!). Allow the user to test this in your main method. 2) (5 points) Add a method called greyScale which will change the picture into a grey scale image. This is done by averaging the values of all three color numbers for a pixel, the red, green and blue, and then replacing them all by that average. So if the three colors were 25, 75 and 250, the average would be 116, and all three numbers would become 116. NOTE: None of these manipulations may cause a color number to be less than 0 nor larger than the maximum color depth specified in the file (color depth is the number on the third line of the file). Grading Each question in the Programming portion of your assignment will be graded as follows: 20% for whether it compiles 30% for whether it runs properly (expected output for given input, etc.) 20% for style (formatting of code, variable names, comments, etc.) 30% for design (efficiency, handling error conditions, etc.) Please make sure your program at least compiles before you submit it! There will be no partial credit for a program that "almost" compiles.
9 years ago