Alright, my assignment was posted, and now I've got something to work with. I'm not typically one to plan this much, but I figure I can do all my documentation at home before I know exactly how I intend to execute the bulk of my assignment.
I'm also sure that I could get in trouble if I gave away all my code on here and an other student was to come across it and use it. I'll post my preliminary blueprinting anyway, because some of you might find it interesting to know how others solve problems.
I intend to break down each of those functions into further commenting to wrap my head around the algorithms I intend to use to write the body of each function, as well as the body of the main function.
ppm.py was written as a means of giving us a way of importing and using the portable pixel map files without having to worry about the exact details of how the lists are generated. I think that its not only beyond us, but would be an immense pain in the ass to create. To make things a little more clear, each image is saved as a list of lists of lists. The outer list is a list of columns. Each item in a
column list is a list of three integers, which represent the red, green and blue components of the pixel's color.
Here's what I've done as far as blueprinting:
#
# A python application that makes use of the module ppm.py and quickdraw.jar
# in order allow a user to display images (taken in the portable pixel map image
# format) and modify them using some of several functions that will process the
# images. When changing an image, both the original and changed versions will
# be displayed for comparison.
#
# Name:
# ID:
#
# import the ppm module in order to import and display portable pixel map images
# in quickdraw:
import ppm
#
# Define the function darken: darken takes an image and converts its color
# a given percentage darker as defined by the user.
#
# Parameters:
# darkimg: The name of a list storing data of the image data to be darkened.
# darkfactor: An integer percent to darken the image by as defined by the user.
#
# Returns: A new list storing the darkened image.
def darken(darkimg,darkfactor):
# stuff
#
# Define the function chromaKey: chromaKey takes two images (a top and a bottom),
# distinguishes green pixels from non-green pixels in the top image, and replaces the
# green pixels from the top image with the existing images in the bottom one.
#
# Green pixels are defined as pixels whose green color portion is at least 20 units
# larger than its red component and at least 40 units larger than its blue component.
#
# Parameters:
# topimg: The name of a list storing the upper image's data.
# botimg: The name of a list storing the lower image's data.
#
# Returns: A new list that has all green pixels from topimg replaced with original
# pixels from botimg.
#
def chromaKey(topimg,botimg):
# stuff
#
# Define the rotate180 function: rotate180 takes an image and modifies it so as to
# have a new image that is a 180 degree rotation of the given image.
#
# Parameters:
# rotimg: The name of a list storing data of the image to be rotated.
#
# Returns: A new list containing the rotated image.
#
def rotate180(rotimg):
# stuff
#
# Define the blur function: blur takes an image to be blurred, and averages each pixel
# with itself and the 8 surrounding pixels in order to produce an average color at each
# pixel, creating a new image which appears to be blurry.
#
# Parameters:
# blurimg: The name of a list storing data of the image to be blurred.
#
# Returns: A new list containing the data for the blurred image.
#
def blur(blurimg):
# stuff
#
# Define the main function: main carries out algorhythms and functions based on user input.
#
# Parameters: None.
#
# Returns: Nothing.
#
def main():
# stuff
# Call the main function:
main()
And here's a lovely picture on my colored terminal running nano.
