Assignment 3 - Due before 11:59 pm on Friday, March 6, 2009

Click here for submission instructions.

Write a PPM Image Viewer/Editor in Java. Your viewer will be capable of viewing binary PPM images, and saving a modified image to a file. The format of a binary PPM image is shown below:

P6

imageWidth imageHeight

maxPixelIntensity

redIntensityValue greenIntensityValue blueIntensityValue, for each pixel in the image, in row-major order.

Your program must have these classes:

  1. PPMViewer
    • This class contains methods to locate a PPM file, and display it on the screen .
    • Use a JFileChooser with an appropriate filter for locating ppm files.
    • Add a crayon tool that can be used to mark up the image. Use a JColorChooser to allow the user to select a color for the crayon.
    • Allow the user to save an image, including crayon marks, to a file.
    • Any file thus produced should be in the ppm format, and viewable by any ppm viewer. IrfanView is a free image viewer that can display ppm files.
  2. PPMImage
    • Represents a ppm image. Model this as discussed in class.
    • Model the image data as a two dimensional array of PPMPixels.
  3. PPMPixel
    • Represents a PPM pixel. This models the RGB values, and the corresponding pixel Color. It also contains a draw() method that can be used to render that pixel on the screen.

Here are some example PPM images. smallgreenBlob, bigRedBlob, a familiar landmark, and yet another image.

Your assignment will be graded using the following rubric:
  1. (10 points) Conformance to the following coding conventions.
  2. (10 points) Code well commented. Comments should say what is being accomplished, not how it is being accomplished.
  3. (10 point) Your viewer must be menu-driven.
  4. (20 points) Allow user to locate and display binary PPM images correctly. Remember to filter out non-PPM images.
  5. (20 points) Allow user to select a "crayon" color and mark the image
  6. (20 points) Allow user to save "marked" image in PPM format in a user-specified file, and redisplay it correctly.
  7. Implement an image compression algorithm of your choice.
    1. (10 points) Your viewer must be capable of exporting the compressed format to a file, and importing and displaying a previously compressed image.
    2. The algorithm you implement may be your own creation, or it could be an existing algorithm.
    3. (10 points) Your submission must include a written description of your algorithm, as a Word document. Email only the write-up to me as an attachment. Follow project submission guidelines for the rest of the project.Your write-up must include:
      • sufficient detail so as to allow the reader to implement it.
      • quantify the compression it achieves
      • describe the effects of your compression algorithm on the image, when it is restored
      • describe ways, if any, in which you can improve your algorithm
    4. (10 points) Your grade for this part of the project will be determined by the extent of the compression achieved (more compression is better), the quality of the resulting image (we want to retain image quality).