CS 1080 Principles of Computing -- Assignment 5

Spring 2006


Due: Friday February 17, 12:20pm Last modified: February 12, 2006

Purpose

The purpose of this exercise is to practice manipulating digital images by changing the numerical values in the image. You will be using a spreadsheet to view and manipulate the numerical values and the GIMP to view the resulting images.

Assignment

  1. Download the image from the instructor's web site.

  2. Open the file using the GIMP to see the image you will be manipulating.

  3. Close the file from the GIMP, then open the file again using Excel. Change the first two columns of numbers to all zeros. Save the file as a text file (not an Excel spreadsheet) with the name blue.ppm. Open the file blue.ppm with the GIMP and make sure that you see an image with only shades of blue.

  4. Return to the original spreadsheet and repeat the process to get a picture that only has a red component, and again for one that only has a green component. Be sure to save each of these files with a different name, like red.ppm and green.ppm. Use the GIMP to check each of your new pictures.

  5. Get a little fancier. Convert your color picture to grayscale. There are two techniques for doing this. One method is to set each pixel to the highest value of it's three component colors. You can use the Excel function MAX() to create a new column that is the maximum of the values in each row, then copy that column and paste those values to each of the original columns, and finally delete the column with the formula. (Note: You will find that after you copy your new column the first time, the values in the new column change!?!? Why is that? You will have to figure out a way around this. Some ideas are  to turn off automatic recalculation, or copy from a column of values instead of a column of formulas. See the instructor if you are stumped on this.) Save this picture as a text file with the name gray-max.ppm. Check your picture.

  6. Another way to set the grayscale is with the formula

    gray value = (0.3 * Red + 0.59 * Green + 0.11 * Blue) 

    Try adding this formula in a new column, then copying the values back to the original columns, like in the previous step. Save your picture as gray-avg.ppm. Check your picture. Which of the gray pictures do you think is better?