Homework 3

[Note: this webpage last modified Friday, 04-Feb-2011 19:44:51 EST]

This assignment will be handed out at the end of class on Wednesday, September 8 and is due (electronically submitted) before class starts on Wednesday September 15.

For the problems dealing with pictures, I suggest trying them out on real life pictures - pictures of people, buildings, nature, etc. The website http://coweb.cc.gatech.edu/mediaComp-teach#Python for the textbook has a mediasources.zip file that you can download with sample pictures, if you want to use some of the same pictures that the textbook uses. You can also use your own pictures, pictures from the web, etc.

You should create a single Python file for your submission. It will include the code for the functions you are turning in, and you can include additional explanations as Python comments.

  1. (10 Points) Write a function called whiteImage that takes as input a picture that has been loaded into JES. whiteImage should make the image so that every pixel is the brightest white (so in a sense, you are "erasing" the picture).

    1. (10 Points) Write a function called yellowImage that takes as an input a picture that has been loaded into JES. yellowImage should make the image so that all pixels in the picture are shades of yellow. For example, the banner at the top of this page might look like this: banner-yellow.jpg . So, after loading your yellowImage function into JES, I will be able to use it as follows.

      	    >>> pic = makePicture(pickAFile())
      	    >>> yellowImage(pic)
      	  

      Hint: Remember that you can make a picture "shades of red" by setting green and blue values to 0 for each pixel. This problem is more complicated because yellow is a combination of red and green (type ">>> yellow" in JES/Python). Also, for this problem you can make use functions we have already done in class or in the book by copying and pasting them into your Python file.

    2. (10 Points) Write a function called orangeImage that is similar to the function from part (a) except that each pixel is a shade of orange rather than a shade of yellow. For example, the banner at the top of this page might look like this: banner-orange.jpg.

      Hint: type ">>> orange" in JES/Python.

  2. (10 Points) For this problem, create your own quiz question on material we have covered so far (but not a question that has been given on the quizzes or in the textbook). Your quiz question can be multiple choice, fill in the blank, or "explain what this program does". Your quiz question should test knowledge on some "tricky" aspect of programming in Python/JES.