In this mini-lab you will gain practice with using for
loops
to process all pixels in a picture.
# Mini-Lab: Functions that Manipulate Pixels in a
Picture
# Your Name
# Today's Date
# Partners:
# Help From:
reduceRed
function from the
Pictures and Loops
notes. Remember to
add a comment for this particular function, such as:
# Reduce the amount of red in a picture by 25%
Debugging Tip: If the function does not work correctly, check that you remembered the colon at the end of the first line of the function definition and that you spelled all of your variable names and function names correctly. Run your code After any edits.
increaseRed
function from the notes.
Remember
to add a comment for each function.
Analysis Questions: What similarities do you see between theInclude your answers to these analysis questions in comments in your program after yourreduceRed
function and theincreaseRed
function? What differences are there between the two functions?
increaseRed
function.
showRedChannel
that sets the blue and
green values for each pixel in an image to be equal to the red
value. For example, a pixel with the value (RED=123, GREEN=18,
BLUE=222) would be changed to (RED=123, GREEN=123,
BLUE=123).
Analysis
Questions: How does showRedChannel
affect
the appearance of your picture? What happens to regions of the
original picture that were red? What happens to regions of the
picture that were blue?
Include your answers to these analysis questions in comments in your
program, either before or after your showRedChannel
function.
makeSunset
function from the notes. Test this on several different
pictures. Remember to add a
comment for this function.