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

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
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, Green, Blue):
for p in getPixels(picture):
setRed(p, getRed(p)(1+Red))
setGreen(p, getGreen(p)(1+Green))
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. Check the FAQ on how to fix this. Kelly Lyons

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

def changeRGB(pict, r, g, b):
for p in getPixels(pict):
re=getRed(p)
gr=getGreen(p)
bl=getBlue(p)
setRed(p, re(1+r))
setGreen(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. Kelly Lyons



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:
setGreen(p, getGreen(p) * (g + 1))
if b > -1 and b < 1:
setBlue(p, getBlue(p) * (b + 1))




Link to this Page