Session Nine, Monday February 4th

 

I didn't use any slides today.  Instead, we had a very interactive session where we looked at a variety of issues that arise when we switch from processing pictures with a single loop (normally done when you modify a picture as a whole) to processing pictures with a pair of nested loops (normally done when you are focusing only on part of the picture).

These issues included:

def mysteryMethod(picture):
   for x in range(1,getWidth(picture)):
      for y in range(1,getHeight(picture)):
         pixel = getPixel(picture,x,y)
         redPart = getRed(pixel)
         greenPart = getGreen(pixel)
         bluePart = getBlue(pixel)
         val = (redPart + greenPart + bluePart)/3
         setColor(pixel,makeColor(val,val,val))

 

Finally, we spent a few minutes talking about what is involved with mirroring part of a picture onto the other part of a picture and how we would do this (independent of code).