Movie of picture negatives # Pseudo Code def movieNeg(directory, pic): for each column of ‘pic’...
-
Upload
ralph-norman -
Category
Documents
-
view
214 -
download
0
Transcript of Movie of picture negatives # Pseudo Code def movieNeg(directory, pic): for each column of ‘pic’...
![Page 1: Movie of picture negatives # Pseudo Code def movieNeg(directory, pic): for each column of ‘pic’ across the entire width for each pixel from top of the.](https://reader036.fdocuments.us/reader036/viewer/2022082709/56649ced5503460f949bacef/html5/thumbnails/1.jpg)
Movie of picture negatives
# Pseudo Codedef movieNeg(directory, pic): for each column of ‘pic’ across the entire width
for each pixel from top of
the column to bottom
convert a pixel to its
negative in ‘pic’
save ‘pic’ into frameXXX.jpg
# Python Codedef movieNeg(directory, pic):
![Page 2: Movie of picture negatives # Pseudo Code def movieNeg(directory, pic): for each column of ‘pic’ across the entire width for each pixel from top of the.](https://reader036.fdocuments.us/reader036/viewer/2022082709/56649ced5503460f949bacef/html5/thumbnails/2.jpg)
LAB
• Complete the movie making that captures column-wise complementing of a picture, if you were not able to finish on Wed.
• Write a function to create animation frames with increasingly more sunset effects.
• Email only your python program (not a screen shot) to [email protected]
![Page 3: Movie of picture negatives # Pseudo Code def movieNeg(directory, pic): for each column of ‘pic’ across the entire width for each pixel from top of the.](https://reader036.fdocuments.us/reader036/viewer/2022082709/56649ced5503460f949bacef/html5/thumbnails/3.jpg)
Create a sunset animation
makeSunset(pic, r) function creates a sunset effect on a single picture called ‘pic’ by reducing green and blue in every pixel by r percent, where the value of r is specified when the function is called. Its Python code is in the next slide.
Write a function that repeatedly calls makeSunset(pic,r), each time with smaller fractional value. After sunset effect is created, the picture is saved into ssXX.jpg with a 2-digit sequence number.
Put together a series of pictures into an animation
![Page 4: Movie of picture negatives # Pseudo Code def movieNeg(directory, pic): for each column of ‘pic’ across the entire width for each pixel from top of the.](https://reader036.fdocuments.us/reader036/viewer/2022082709/56649ced5503460f949bacef/html5/thumbnails/4.jpg)
Sunset effect on one picture
def makeSunset(picture, r): for x in range(1, getWidth(picture)): for y in range(1, getHeight(picture)): p = getPixel(picture, x, y) value=getBlue(p) setBlue(p,value*r) value=getGreen(p) setGreen(p,value*r) return picture
![Page 5: Movie of picture negatives # Pseudo Code def movieNeg(directory, pic): for each column of ‘pic’ across the entire width for each pixel from top of the.](https://reader036.fdocuments.us/reader036/viewer/2022082709/56649ced5503460f949bacef/html5/thumbnails/5.jpg)
Slow Sunset in animation
We know how to make one picture with a sunset effect
Repeatedly apply sunset effect on the same picturedef slowsunset(pic):
rate = 1.0 Repeat for N times
create an empty picture with the same dimension as ‘pic’ Reduce the value of ‘rate’ (say, by 1/N) newPic = makeSunset(pic, rate)
save newPic as ssXX.jpg
![Page 6: Movie of picture negatives # Pseudo Code def movieNeg(directory, pic): for each column of ‘pic’ across the entire width for each pixel from top of the.](https://reader036.fdocuments.us/reader036/viewer/2022082709/56649ced5503460f949bacef/html5/thumbnails/6.jpg)
Final Project
Due: 5/7 (Th) 3:00 pm Presentation of the final project:
2-min presentation on 4/17 (F) on project topic 10-min each on 5/7 3:00-6:00pm