Question: Create a new version of the lineDetect function (Program 55 (page 128)) that takes in a threshold and create a movie using lineDetect where the

Create a new version of the lineDetect function (Program 55 (page 128)) that takes in a threshold and create a movie using lineDetect where the threshold changes depending on the frame number.


Data from Program 55

def luminance (pixel): r = getRed(pixel) g = getGreen (pixel) b = getBlue (pixel) return (r+g+b)/3 %3D def edgedetect(source): for px in getPixels(source): = getX(px) y = getY(px) if y < getHeight(source)-1 and x < getWidth(source)-1: botrt = getPixel(source, x+1, y+1) thislum = luminance (px) brlum = luminance (botrt) if

def luminance (pixel): r = getRed(pixel) g = getGreen (pixel) b = getBlue (pixel) return (r+g+b)/3 %3D def edgedetect(source): for px in getPixels(source): = getX(px) y = getY(px) if y < getHeight(source)-1 and x < getWidth(source)-1: botrt = getPixel(source, x+1, y+1) thislum = luminance (px) brlum = luminance (botrt) if abs (brlum-thislum) > 10: setColor(px, black) X = if abs (brlum-thislum)

Step by Step Solution

3.43 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

def edgeDetectdirectory picture width getWidthpicture height getHeightpi... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction to Computing and Programming in Pytho Questions!