CSC 161 Grinnell College Fall, 2011 Imperative Problem Solving and Data Structures

# CSC 161 Module 4: Image Processing with the Scribbler 2

## Summary and Main Topics

This module introduces the customizable nature of self-written programs by using structs and 2-dimensional arrays, particularly emphasizing their uses with Myro Pictures.

1. Pictures
2. Structs
3. Pixels
4. Two Dimensional Arrays
5. Insertion Sort

## Day-by-day Details

Day Topic Preparation In-class Due Date Availability
for
Extra
Credit
Tuesday, October 25 Module 4: Pictures
Examples
Wednesday, October 26 Structs: Transform a Pixel
lab exercise
Friday, October 28 Two Dimensional Arrays
• K&R 5.7, 6.3 - 6.4
lab exercise
Monday, October 31 Insertion Sort lab exercise
Tuesday, November 1 Module 4 Project Day 1   project Wednesday, November 9
Wednesday, November 2 supplemental problem 3 Wednesday, November 2
Friday, November 4 Module 4 Project Day 2   project Wednesday, November 9

## Project: Picture Suite

For this project, you will write the following series of functions which modify a picture. Each function should include tests and examples of pictures which it modifies.

• ### void pixelStrip (Picture * pic, char color)

This function should set the R, G, or B value of every pixel in the picture to 0 (depending on what char color is).

• ### void pictureRedder (Picture * pic)void pictureGreener (Picture * pic)void pictureBluer (Picture * pic)

These functions should increase the intensity of their respective colors (red, green, or blue). This increase should never go past 255. The color should increase less when it is already high than when it is low.

• ### void circleSelect (Picture * pic, int xCenter, int yCenter, int radius)

This function should select a circle from your picture and turn all of the pixels within that circle gray.

• ### a creative function of your choosing

This function should do something interesting and creative to your picture. It should not just be a rehashing of a previous exercise or lab, and there should be a good amount of thought and effort placed into this function.

This project will be worth 25 points, based on the following rubric:

• Criteria 1: void pixelStrip (Picture * pic, char color) with .jpg images of example pictures included. (5 points)

• Criteria 2: void pictureRedder (Picture * pic), void pictureGreener (Picture * pic), void pictureBluer (Picture * pic) with .jpg images of example pictures included. (5 points)

• Criteria 3: void circleSelect (Picture * pic, int xCenter, int yCenter, int radius) with .jpg images of example pictures included. (5 points)

• Criteria 4: A creative function of your choosing with .jpg images of example pictures included. (5 points)

• Criteria 5: All of your functions should be clear, concise, and well documented. They should all include examples, with attached .jpg images of the original and modified pictures. You should create these .jpg files using the rSavePicture() function. (5 points)

This document is available on the World Wide Web as

```http://www.cs.grinnell.edu/~walker/courses/161.fa11/modules/module-struct-2d-arrays/module-struct-2d-arrays.shtml
```

 created 19 July 2011 by Erik Opavsky last full revision 8 August 2011 by Erik Opavsky edited 2 September 2011 by Henry M. Walker edited 1 November 2011 by Henry M. Walker For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.