Topic 1 - Variables and Data Types
Topic 2 - Conditionals and Strings
Topic 3 - Loops
Topic 4 - Arrays
Topic 5 - File Handling
Semester 1 Projects
Topic 6 - Classes/Objects and Methods
Topic 7 - ArrayLists
Semester Projects

Introduction

  • You would like to pursue Graphic Design/Arts and Computer Science in the future.
  • You feel comfortable with Java.
  • You would like to explore more advanced algorithms.
  • Rather than making a game, you would like to understand how a program like Photoshop works.
  • You would like to implement advanced image processing algorithms including, but not limited to, image filters.
  • You enjoy a challenge.

Starter Code Files

https://github.com/emlag/DarkRoomPro

Project Setup

Possible Troubleshooting

Introduction

In this project, you’ll add functionality to a photo editor! This will provide practice with 2D data structures, structures that use Objects of different types, and with adding code to a large-ish code base. These are all essential skills in programming and we hope that the assignment provides a fun way to practice with these topics.

The assignment also includes an algorithm for “seam carving” (i.e., removing a column of pixels), which is an example of using dynamic programming (or DP). DP is a problem solving strategy to take naturally recursive solutions and avoid duplicate calculations by working from the base case of a recursive algorithm and progressively building up to the solution you want. If you want to know more, I can give students who choose to do this assignment a quick presentation on it.

You will gradually extend the functionality of the program by writing several methods in the Picture class within the Picture.java file. Make sure to test the methods you write using the provided JUnit test cases along the way!

Seam Carving

Seam carving was first published in this paper by S. Avidan and A. Shamir in 2007. It’s a relatively accessible paper – take a look!

Seam carving finds the “least-noticeable” seam from top-to-bottom or left-to-right in an image. Then, repeated seam removal allows for image-aware resizing to any smaller size. As with all of CS, this requires quantifying what is meant by ”least-noticeable”! For us, ”least-noticeable” refers to the shortest path through the image, where distance is defined to be the total strength of the image edges traversed along the way. The paper offers a seam-insertion algorithm for resizing to larger image sizes, too, though that won’t be an official part of this assignment.

You’ll have a number of steps you’ll use and you’ll likely find the following picture of the steps helpful! NOTE: This photo is Micro.bmp

File Structure

In the provide starter files for this project there are many images (used for testing) and a number of .java source files. The only .java file you’ll need to edit is Picture.java. The other ones you’ll use are PictureTest.java (for running the JUnit tests) and Pixel.java (for accessing the images’ pixels). There other files listed below, but knowing their details is not important for completing this assignment. Here is an overview of all of them:

Files to Edit

• Picture.java: This class is a subclass of the SimplePicture class, and has placeholders where you’ll implement various pixel-processing routines.

Files to Understand and Use, but not Modify:

• Pixel.java: This class provides static and non-static accessor methods that allow you to obtain information regarding a pixel in a picture. This also uses Java’s built-in Color class. Here is the online reference for that Color class.

• PictureTest_<SomeTestName>.java: These classes contains the JUnit test cases that test the functions in the Picture class. You won’t need to write additional tests, but you will want to use these tests. Once you pass all of these, you will know you’re done 🙂

Other Files

• FileChooser.java: This class controls and abstracts the file choosers that allow the user to select files to open and save.

• ImageDisplay.java: This class controls and abstracts the image display and the crosshair feature.

• PictureExplorer.java: This class brings together and controls the various elements of the graphical user interface.

• PictureFrame.java: This class controls and abstracts the frame containing the picture.

• SimplePicture.java: This class is the parent of the Picture class, and also stores variables and methods relating to a particular picture file, allowing the Picture class to deal only with the various features that can be implemented on that picture file.

Running the Starter Code

Find the Picture.java file. Right click on the file and run it. This program should show up on you screen.

Try to…

  1. Load a new image with File – Open. You’ll have to navigate to the DarkRoomPro/src/main/resources folder the first time, but for additional images, it should start wherever you left off the previous time. Okinawa.bmp and Camel.bmp and several others are available. Also, try your own images or ones you grab online!
  2. Zoom in/out. If you use the 5000 % zoom on anything but a very tiny image, it will likely run out of memory – this is Ok.
  3. The only image-processing method that works within the starter code is the Change colors Grayscale. Try that, too.
  4. File – Reset Picture tries to reload the file with the same filename as the last image displayed. If the last image displayed did not have a filename, you’ll have to use File – Open… instead.

The rest of the options are the rest of the project – or the extension!