Project 2: Image Processing Program

Phase 1 Due Oct 16 and Phase 2 Due Oct 23
(points 170 total)


You are to create a program that is a GUI Java application. It will allow the user to load and image and present the user with a set of Image Processing Functions that they can choose to apply. After loading an image a display of the image will pop up.

The user can choose to perform operations on the entire image or only a Region of Interest (ROI), a smaller sub-image. The user can select using their mouse the Region of Interest in a click to select upper left hand corner and drag and lift to lower right hand corner. If they choose to select a ROI, then a second window is displayed showing only the ROI.

Now the user can choose various operations and it will be applied to the active image window (either the orginial image or the ROI image). The new image will be displayed in the same active window.

Also, the user should be able to save the image data to a file. Note that the image data that has been processed is not saved to a file until the user specifically asked to do this operation.

This project is broknen up into two phases. The first phase will only implement the image loading, display, saving and selection of Region of Intrest (ROI). For phase 2, you will have to the image processing operations on the active image (either original or ROI image) of: thresholding, image negative, contrast stretching. The elements of each phase are described below.

After a valid image is loaded, the following operations (displayed as menu items) should be enabled:

  • File Menu = Open, Save As, Exit
  • ROI Menu = Create
  • Process Menu = Undo, Threshold, Contrast Stretch, Image Negative

Note, when some options are choosen, other windows that may ask for necessary relavent user input may pop-up before the image function takes place on the image already loaded. For example, when Threshold selected, asks for threshold value.


IMPORTANT: After each selection is made, it is applied to that active image window and the processing is completed the new resulting image should be displayed in the same active windo. Any further processing requested by the user will be done on the active image.

Note: You are only required to load the standard formats of JPEG and GIF that Java accepts.

You should be able to perform the options on either a color image or convert it first to a greyscale image. In the case of color, many of the operations will be with respect to the three fields of red, green and blue instead of the grey value for the case of a greyscale image.

 

THIS IS NOT GROUP WORK. You must do it individually.
 

TIPS

  • You may use the following partial java code to get you started. Included in here are java source files as well as the GUI files needed. (note uses old IDE Visual Cafe but, you can convert using java code to your IDE).
  • See the comments in the code, to help you get started.
  • Change the loading of images to use MediaTraker class to make sure the image loaded successfully.
  • You will need to use PixelGrabber class to grab data into an array that you can manipulate.

Suggested Data Classes and their Meanings

Class

Meaning

ImageClass

Contains information about the Image (size-#rows, #columns, format, filename) as well as the image data itself.

You may want to embed any necessary ROI information (like location, size with respect to original image, name of original image) in this class (or make it another class)

Note: You may be able to use a data field of this class the Image class in Java, or there may be other classes out there.

 

Suggested Data OBJECTS and their Meanings

Object Name

Class

Meaning

ActiveImage ImageClass Contains current image being displayed in the current window (note you can have multiple. Represents the current state of the image as pertaining to processing
BackupImage ImageClass

Contains an image that represents the ActiveImage before the last processing operation selected.

Note: Initially, before any processing has been done, it will contain the same information as ActiveImage.

 

 

Phase 1

In this phase, you will develop a GUI java application that will allow the user to load an image and display it. The user can save the image data currently displayed. The user can also through the use of a mouse (as described up above) select a ROI which will automatically be displayed in a second window.

Eventhough you will not have implemented the image processing operations you should have the File menu there to select them.

SW Development: You can use any visual editor. On campus, we have JBuilder (you can go to the open Science PC lab) and you are welcome to use this. You can get the same limited edition free off the Internet for education use. If you use any GUI editor, you must archive all of the files used (remember visual editors may use classes not in standard java SDK) for your delivery of the code.

Option: ROI ->Create
This you need to implement for Phase 1 of the project. If selected the user will wait for Mouse events (as described above) to get the upper left and lower left corner images of a rectangular ROI. Then create an Image object from this with the corresponding data in it and display it in a new windwo.

Option : File -> Open
Open image either JPEG or GIF. You will need to read on your own how to use Java Media Package or similar to do this. You will need to bring up a file dialog box to get location and name of file from user. You will store the image into the ActiveImage and the BackupImage objects

Option : File -> Save As
Save image as a JPEG or GIF. You will need to read on your own how to use Java Media Package or similar to do this. You will need to bring up a file dialog box to get location and name of file from user.

Option : File -> Exit
If this option is choosen simple exit the program. Make sure that you close any windows with images displayed in them.

 


 
 
 

Phase 2

You are now coing to implement the various Processing operations.

Option : Undo
This will only undo the last processing operation that was selected by the user. This means that you will need 2 images. One called ActiveImage that is what is currently being displayed and BackupImage that is the image previous to the last processing operation. Initially before any operations have been selected these two are identical.

When the user selects Undo, you can copy this BackupImage into ActiveImage and refresh the display.

Option : Threshold
If this option is selected, you must ask (dialog box) the user what threshold level (from 0 to 255) they would like to choose. Then threshold the image using this level and display the results. Display this new output image.

Option : Image Negative
Create the negative image and display.

Option : Contrast Stretching
If this option is choosen you should perform contrast stretching, telling user information about the current contrast and somehow making an interface that lets the user alter (either up or down) the contrast of the image.

 


Evaluation Guidelines

Deliverables for each phase

  1. Fully comment and test out program. Post on the server.
  2. Turn into USB keyfob/CD with all java code and compiled class files needed to run the program. IF YOU use additional classes not in standard Java, you need to have all of the files here...make a JAR file. I want to you to have the program ready to run already compiled!
  3. Printout of code, fully commented, with YOUR NAME ON TOP, and INSTRUCTIONS ON HOW TO RUN THE CODE FROM YOUR USB keyfob/CD.
  4. A one-page describing how code is structured and the state of how it works.
  5. Print outs of screen shots showing the results of: image loading and display of image before and after each processing operation is choosen.

 

© Lynne Grewe