Calvin College seal
CS 108 Introduction to Computing
Homework #10

Configure Your Project

  1. Follow the instructions for proposing a final project given here: final project proposal.
  2. Create a new package in your project named edu.INSTITUTION.USERNAME.hotj.homework10.
  3. Create a file named design10.txt for your time estimates.
  4. Import the classes you built in lab #10 into the edu.INSTITUTION.USERNAME.hotj.homework10 package.

The Projects

Your instructor will assign you one or more of the problems below. They all involved adding image manipulation effects to the Chimp tool.¹

Homework #10.1: The Blur effect “softens” the color boundaries through out the image. Here is an example of what the effect looks like after the “Blur” button has been pressed a few times:

the original image: the blurred image:
original image blur effect

To create this effect, you average the color intensity values for a pixel based on the color values of all its neighboring pixels. For example, if your original image had a section of Pixels whose red components have the following intensity values:

11611965
851431
177555

you should, in your blurred image, set the new value of the red component for the center Pixel to 74, the average of all of the pixels in the 3x3 square. Note that because your blurring operation changes the pixel color values in your image, you will need to use a copy of the image as the source of the original pixel color values.

Homework #10.2: The “Rotate” effect turns the image 90 degrees. Here is an example of what the effect looks like:

the original image: the rotated image:
original image rotate 
	      image effect

Though it may be hard to see in this relatively square image, the rotated picture has its width and height swapped with respect to the original picture.

Homework #10.3: The Polarize effect sets the color values of each pixel to extreme limits. Here is an example of what the effect looks like:

the original image: the polarized image:
original image polarize
	      image effect

Polarize sets each pixel color intensity value to either 255 or 0 based on whether the value is greater or less than the average value for that color across the whole image. You must first find the three average pixel values in the image, one for each color, and then set each Pixel’s R, B, G value to either 0 or 255 based on its relation to the average values.

Homework #10.4: The “Gray Scale” effect removes the RGB color differentiation in the image. Here is an example of what the effect looks like:

the original image: the image in gray-scale:
original image gray-scale
	      image effect

This effect is implemented by setting the color values for a pixel to the average of the individual red, green, and blue for that pixel.

Homework #10.5: The Shift effect from the lab exercise shifts the entire image to the right by 1/2 of the width. Modify that code in two ways: it should shift to the right and down; and it should support shift factors (in both directions) other than 1/2. Here is an example of what the effect looks like for a shift factor of 1/3 in both directions:

the original image: the image shifted 1/3 right and down:
original image multi-shift
	      image effect

For this effect, you can hard-code the two shift factors (i.e., the right and the down factors); You can receive extra credit if you modify the interface to request the shift factors from the user.

Homework #10.6: The Zoom effect magnifies part of the image. Here is an example of what the effect looks like:

the original image: the zoomed image:
original image zoom
	      image effect

In this effect, the image stays the same size, but the pixels from the upper left portion of the original are quadrupled in size, that is, each of the pixels in the upper left take up 4 pixels in the new image rather than just 1. You’ll notice that the zoomed image has a lower resolution that the original.

Turn In

Turn the following things:

  1. All source files you created for your project
  2. Sample executions of your GUI (using a screen captured image file)
  3. Your estimated/actual times
  4. Your final project proposal

¹ This homework is based on work by Wicentowski & Newhall (see http://web.cs.swarthmore.edu/~newhall/imagemanip/).

Back to the top