Assignment 30 — image manipulation
Due Tuesday, November 17
Module flip.py
- To implement three functions to support flipping an image on its vertical axis.
Function size( original )
- Returns the size of the flipped image. As flipping does not change dimensionality, the new image is the same size as the
original
.
Function where( nspot, original )
- Returns the correspondent spot in the
original
to find the pixel for locationnspot
in the new image.
- Observations:
- A pixel that is x units from the left side in the flipped image is x units from the left side in the
original
image.
- A pixel that is y units from the top side in the flipped image is y units from the bottom side in the
original
image.
Function color( opixel )
- Returns how to tweak
opixel
to get the pixel for the new image. As flipping does not tweak the pixels, the new pixel is the same asopixel
.
| |
© 2020 Jim Cohoon | Resources from previous semesters are available. |