|
||||||||||
Image Arrays Exercisedue April 18, 11pm but may checkoff in class 20th50 points In this exercise, you will gain experience with multi-dimensional arrays as well as use in image manipulation. This application will help you start your Project 2. Program Purpose The application will be to create a simple image processing program that will brighten each pixel value in an image (each element in the array representing the image) by adding to it a constant value making sure the resulting value does not exceed 255. The method you will write that will brighten the image is called brighten(int x) x is the ammount you are increasing all of the image pixel values by. It will then save the image to the original file it read it from.
Tools to View Images Tools to download a tool to open up and display PGM files which
|
Special new methods of ImageData class |
|
Class |
Meaning |
ImageData | Contains information about the Image (size-#rows, #columns, format, filename) as well as the image data itself.
tip: You may be able to use as variable of this class the Image class in Java, or there may be other classes out there rather than having the data variable of ImageData being a 1D array. BUT, this is not a requirement. However, feel free to alter this code as long as you get it to work
>> method brighten(int x) = you need to create this method as described in the algorithm below that will work on this classes ImageData.Image and brighten each pixel by a value of x.
>> method saveToFile() = saves to file you read the image from the current data. |
Introduction - Image Manipulation - Brightening
method algorithm
##############YOU NEED TO ADD CODE THAT LETS YOU######## Brightening algorithm You need to implement the following algorithm: for (each element in the 2D array image, i) { i = i + value; if (i > 255) i = 255; //saftey check as pixel value cant be above 255 } |
Deliverables