Class 34 — November 16

Visualization

What do you picture – For a happy future life – We wish you success


Look both ways


Two personal questions


Another question


Agenda


What is the third part of the course?

photo manip gui

15 sliding puzzle from wikimedia

 

 


Even more questions


Next time — Monday!!


To do


Some possible basic transformations

original original

Duplicated image


original original

Mirrored image


originaloriginal

Flipped image


originaloriginal

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


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