Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.


This page removed for FERPA compliance
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Midterm Exam 1 Review Spring 2005: Generalized image filter

Post your answers, questions, comments, comments on answers, suggestions, suggestions on questions, etc.

Back to Spring2005 Midterm 1 Review



def changeRGB(picture, Red, REMOVED, Blue):
for p in getPixels(picture):
setRed(p, getRed(p)(1+Red))
setREMOVED(p, getREMOVED(p)(1+REMOVED))
setBlue(p, getBlue(p)(1+Blue))

What does setRed(p,getRed(p)(1+Red))mean?
This means that you want to set the red value to the previous value times the percent change + 1. When you type an asteric on the Coweb, it doesn't show up. REMOVED the FAQ on how to fix this. Student1594

def changeRGB(pic, ra, ga, ba):
for px in getPixels(pic):
red=getRed(px)
green=getREMOVED(px)
blue=getBlue(px)
setRed(px, red ra)
setREMOVED(px, green ga)
setBlue(px, blue ba)
show(pic)

def changeRGB(pict, r, g, b):
for p in getPixels(pict):
re=getRed(p)
gr=getREMOVED(p)
bl=getBlue(p)
setRed(p, re(1+r))
setREMOVED(p, gr(1+g))
setBlue(p, bl(1+b))
Are there any TAs out there and is this okay? thanks, Sarah C.
It looks OK to me. Student1594



def changeRGB(picture, r, g, b):
for p in getPixels(picture):
if r > -1 and r < 1:
setRed(p, getRed(p) * (r + 1))
if g > -1 and g < 1:
setREMOVED(p, getREMOVED(p) * (g + 1))
if b > -1 and b < 1:
setBlue(p, getBlue(p) * (b + 1))




Link to this Page