COMP151 - Lab 4
For your fourth lab you’ll work on using if statements to conditionally change an image. Recall that in section 5.1 we learn how to select pixels if: they’re in a specific region, they’re close to another color, or their channel values are within a specific range. Continue to look for opportunities for code reuse and hierarchical decomposition. As always, don’t forget that at the end of each chapter contains a Programming Summary section that provides a quick dictionary of all of the important function and encoding names introduced thus far. When you run into problems don’t forget to check the Common Bugs and Debugging Tips scattered throughout the chapters as well.
- As always switch the driver (person typing the code) and navigator (person watching, helping spot typos, etc.) on every new problem or every half hour, whichever comes first.
- Do all of the problems in a single python file. Put everyone’s name in a comment at the top of the file. Label the start of each problem with a comment.
- For any problem that includes responding to questions as well as interacting with python code, write your responses as a comment. along with the required code.
To Do
For warm-up, do the following problems from chapter 5: 5.1, 5.2, and 5.11.
- Print and submit these problems before you move on to the next task.
Now that you’re warmed up and ready to code, it’s time for the first ever COMP151 art competition! Download the starter image from the course website and work with your partner to design and program your very own effect.
- Write the program to generate your effect in a file all by itself. Do continue to use sub-functions and hierarchical decomposition where it makes sense.
- You can use any of the ideas or techniques from chapters 4 and 5 but must use at least one if statement as a part of the effect.
- When you’re satisfied with the result, or when time is up, save the picture to the computer and email it along with your to the professor. Section 4.2 discusses writing the picture to a file. You might also want to look at 5.1.1 about setting a media path.
- We’ll vote for best picture on Wednesday!