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...

To select several nonadjacent items, hold down the Ctrl key

Indicate whether the statement is true or false

Computer Science & Information Technology

You can only perform a desk-check using an algorithm's pseudocode.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology