 |  |

 |
 |  |  |
 | Welcome to CS1315. Click on the python to add comments.
|  |
 |  |  |
|
This page removed for FERPA compliance
|
        |
Pixel Play
Imagine we have a picture which measures 3x3 pixels with (r,g,b) values:
| (128,128,128) | (255,255,255) | (10,0,0) |
| (128,255,0) | (255,128,0) | (255,255,0) |
| (10,0,255) | (128,128,255) | (10,0,255) |
1) Show how the original picture is changed when used as the input to this function:
def foo( pic ):
for pixel in getPixels( pic):
r = getRed( pixel )
g = getREMOVED(pixel)
b = getBlue(pixel)
setRed(pixel, r-10)
setREMOVED(pixel, b)
setBlue(pixel, r)
| ( , , ) | ( , , ) | ( , , ) |
| ( , , ) | ( , , ) | ( , , ) |
| ( , , ) | ( , , ) | ( , , ) |
2)Show how the original picture is changed when used as the input to this function:
def bar( pic ):
for x in range(2,3):
for y in range (1,2):
pixel = getPixel(pic, x, y)
r = getRed(pixel)
g = getREMOVED(pixel)
b = getBlue(pixel)
if ( r<40 and g > 200):
setRed(pixel, r-10)
setREMOVED(pixel, b)
setBlue(pixel, r)
| ( , , ) | ( , , ) | ( , , ) |
| ( , , ) | ( , , ) | ( , , ) |
| ( , , ) | ( , , ) | ( , , ) |
Questions?
Link to this Page