Class 34 — November 16
Visualization
What do you picture – For a happy future life – We wish you success
Look both ways
Two personal questions
- What is your daily routine?
- Why do you have routine(s)?
Another question
- What is a pattern?
Agenda
- Prepare for the third part of the course
What is the third part of the course?
Photo manipulation
Sliding puzzle
- Green screening
Coloring
Even more questions
- What is an algorithm
- What is a program
- What is a programming paradigm?
- What is a software design pattern?
- What are some software design patterns we have considered?
Next time — Monday!!
- We are going to fill in the class from the front.
- The teaching assistants will direct you to which section.
- If you are assigned a left or right section, take the innermost available seat in your assigned row.
- If you are in the center section, fill in from the middle of your assigned row.
To do
- Review the Pillow modules's capabilities.
- Further review the Pillow Image capabilities — we are going to be using them on Monday!!
Some possible basic transformations
Duplicated image
Mirrored image
Flipped image
Clockwise rotation
Basic photo-manipulation problem-solving pattern
# get dimensions of the original
ow, oh = ...
# set dimensions of the new image
nw, nh = ...
# get a new appropriately sized image
new_image = Image.new( 'RGB', ( nw, nh ) )
# fill in every pixel of the new image
for nx in range( 0, nw ) : # consider every x value for the new image
for ny in range( 0, nh ) : # in tandem with every y value for the image
# set the spot to be filled in the new image
nspot = (nx ,ny )
# determine the corresponding spot of interest in the original
ospot = ...
# get the pixel at the ospot
opixel = ...
# determine the pixel for the new image
npixel = ...
# set the nspot in the new image
...
# return the filled in new image
return new_image
- Questions to ask yourself before attempting the transformations:
- How do the dimensions of the transformation compare with the original?
- What is the correspondence between the pixels from the transformation with pixels from the original?
© 2019 Jim Cohoon | Resources from previous semesters are available. |