Lec17Images3

# Lec17Images3 - Today 1 More filters 2 Parameter passing...

This preview shows pages 1–2. Sign up to view the full content.

Today: 1) More filters 2) Parameter passing: modifying an input vs returning a result 3) Passing functions as parameters 4) Flipping a picture over (sideways or upside-down) 5) Drawing a triangle (if we have time) From a previous lecture: def makeGray(pixel): red = pixel.getRed() blue = pixel.getBlue() green = pixel.getGreen() gray = (red + blue + green) // 3 return Pixel(gray,gray,gray) Let’s make the picture a little lighter. Let’s say we had a pixel: red = 128 green = 0 blue = 255 black: 0,0,0 white: 255, 255, 255 Lighter means bigger numbers We could multiply each value by 1.x, capping the value at 255. Average the number with 255 Multiply by 1.5, but max out at 255 red = 192 green = 0 blue = 255 Average the number with 255 red = 192 green = 128 blue = 255 We chose the second one: average the number with 255 def makeLighter(pixel): red = pixel.getRed() blue = pixel.getBlue() green = pixel.getGreen() red = (255 + red) // 2 green = (255 + green) // 2 blue = (255 + blue) // 2 return cImage.Pixel(red,green,blue)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 2

Lec17Images3 - Today 1 More filters 2 Parameter passing...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online