Create a new version of the lineDetect function that takes in a threshold and create a movie using lineDetect where the threshold changes depending on the frame number.

What will be an ideal response?


```
def edgeDetect(directory, picture):
width = getWidth(picture)
height = getHeight(picture)
for num in range (1 ,10):
canvas = makeEmptyPicture (width,height)
copy(pic, canvas, 0, 0)
val = 10-num+1
edgedetect(canvas, val)

numStr=str(num)
if num < 10:
writePictureTo ( canvas , directory +"//frame0"+ numStr +".jpg")
elif num >= 10:
writePictureTo ( canvas , directory +"//frame"+ numStr +".jpg")
movie = makeMovieFromInitialFile(directory+"/frame00.jpg");
return movie
def luminance(pixel):
r = getRed(pixel)
g = getGreen(pixel)
b = getBlue(pixel)
return (r+g+b)/3
def edgedetect(source, threshold):
for px in getPixels(source):
x = 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)> threshold:
setColor(px,black)
if abs(brlum -thislum)<=threshold:
setColor(px,white)
```

Computer Science & Information Technology

You might also like to view...

Write a method to keep just the green color.

What will be an ideal response?

Computer Science & Information Technology

What does the statement throw; do?

What will be an ideal response?

Computer Science & Information Technology

The Eraser tool can be used to merge cells

Indicate whether the statement is true or false

Computer Science & Information Technology

Which of the following are functions of the access layer in the hierarchical network design models?

It is used to enforce security policies It provides fast transport It provides end-user connectivity It connects users and user devices to the backbone

Computer Science & Information Technology