Assignment 7 for CSE 130/DXARTS 198A

Spring Quarter, 2008

This assignment is not a team assignment, but is to be done by each student individually. Enter your answers into a Word file. Also turn one Python file for each item in your portfolio. Turn in your files by uploading them to our CollectIt dropbox and submitting them as Assignment 7. They are due Friday, May 23 at 5:00 PM. The dropbox is at the UW Catalyst web site, linked from here.
Create a portfolio of applications of programming techniques to image processing. The images you use in these examples should be limited to no more than 512 by 512 in order to reduce the likelihood of running out of memory. Include the following items in your portfolio.
  1. Technique: Sequential Flow
    Application: an interesting setup for PixelMath
    Some possibilities are showing transformations for hiding and unhiding messages in images; showing groups of transformations creating a collection of related stereograms. This program should download at least one image, which should be an image of your own, and it should be in the old forum, accessible to all. Name this Python file sequentialFlow.py.
  2. Technique: Looping
    Application: an interesting transition using a loop.
    An example of such a transition is a wipe. Here are a few ideas for wipes: a diagonal line moves across the screen bringing the new image into view; a circular window opens up; an array of circles are opening up; Something different from a wipe is the following: some ripples get more intense and then relax, but the image is different at the end. This program should download at least two images, which should both be images of your own, and they should be in the old forum, accessible to all. Name this Python file looping.py.
  3. Techniques: User input and branching
    Application: an interactive image effect in which you get some input from the user and then take action.
    The input should be the answer to a YES/NO question using a dialog box. You should use the pmGetString(str) function to display the dialog box and get a string from the user. Convert the string to lower case using the lower() method -- for example s.lower(). If the resulting string is equal to "y" or to "yes", then we'll assume that the user answered Yes.
    The YES/NO question might allow the user to choose among two different source images or perhaps between two different kinds of effects. Another idea is to let the user see a transition between two images A and B, but they get to choose which image comes first, or they get to choose whether a wipe involves a left-to-right or a top-to-bottom motion. Name this Python file userYesNoInput.py.
  4. Techniques: Numeric input.
    Application: an interactive image effect in which you get numeric input from the user and then use this number in an effect.
    Get the numeric input using a dialog box. You should either use the pmGetInt(str) function or the pmGetFloat(str) function. The first is for getting integers (whole numbers), and the second is for getting floating-point numbers, such as 3.14. Each of these functions takes a string argument that represents the prompting message in the dialog box.
    The parameter might control a threshold or hue shift amount, or something else. Make sure that the dialog box includes a prompting message that says what range of values are acceptable to your program. Name this Python file userNumericInput.py.
  5. Technique: Function Definition and Calling
    Application: an effect implemented by a Python function that you define.
    The function should take one or more arguments. Then you should show what it does when called with different arguments. The effect could involve an image transformation, or image synthesis, or some kind of transition, or some kind of window setup. For example, you could define a function that rotates an image in Window 1 by some angle theta and puts the result in Window 2; your function would take one argument, the value of theta. It would use the value of theta to complete a PixelMath calculator formula and it would apply that formula with the appropriate source and destination to make the rotation happen. Your Python program for this item should include the function definition (that starts with def), a line that opens up an image that you have made available to all, and at least two calls to the function to show it operating with different values of the argument(s). Name this Python file usingFunctions.py.
  6. Extra credit problem (worth 10 percent extra). Modify the slide-show-with-dissolves program so that it does the following: (1) defines three functions, each corresponding to a different transition effect, (2) prompts the user for a number in the range 1 to 3, so that the user gets to choose what kind of transitions with be used, and (3) shows four of your own images in the show. Your three transition effects should be new -- not ones we have shown in class or that appear in the notes or worksheets. Name this Python file controlledSlideShow.py.
For each item in the portfolio, include in your Word document: 1. a brief explanation of what the program does (two or three lines of text). 2. The Python code for the program. (The code should be submitted both in the Word document and in the separate .py files.) 3. Sample images or screen shots that illustrate clearly what the program produces. You might need only one image, but you might need several if you are showing a transition effect.
Altogether, you should turn in six files for this assignment: Assignment7.doc, sequentialFlow.py, looping.py, userYesNoInput.py, userNumericInput.py, usingFunctions.py. If you choose to do the extra problem, then you should also turn in a file named controlledSlideShow.py.
The images referred to by your programs should be on the server in the first forum, and accessible to all.