Assignment 6 for CSE 130/DXARTS 198A

Spring Quarter, 2008

Part 1 (Individual Work)

Enter your answers for both parts into a Word file. Turn in your file by uploading it to our CollectIt dropbox and submitting it as Assignment 6. It's due Friday, May 16 at 5:00 PM. The dropbox is at the UW Catalyst web site, linked from here.
  1. At the end of Chapter 15, do exercise 1.
  2. At the end of Chapter 15, do exercise 2.
  3. Create a Python program that downloads an image that you have uploaded to the server and performs a series of transformations to it. The following program is a guide. You should change all the printed comments, the image being downloaded, and the formulas involved. For formula ideas, you might look at your portfolio assignment from week 4. You'll want a total of 6 transformations. Each pair should be separated by a 2-second pause, as shown, using the pmSleep function.
    print "A little demonstration of image transformations..."
    print "First let's get an image from the server."
    pmOpenImage(1, "server:tanimoto:mona-rgb.jpg")
    pmOpenImage(2, "server:tanimoto:mona-rgb.jpg")
    print "Let's set the source and destination."
    pmSetSource1(1)
    pmSetDestination(2)
    print "Now for Mona upside down."
    pmSetFormula("S1(x,ymax-y)")
    pmCompute()
    pmSleep(2000)  # wait two seconds, please.
    print "And now for a blueish version of Mona."
    pmSetFormula("HSV(Hue1(x,y)+0.5,Sat1(x,y),Val1(x,y))")
    pmCompute()
    print "All done."
    
  4. The distance between two points is typically interpreted as the Euclicean distance. This is computed as follows: Let (x0, y0) be the coordinates of one point, and let (x1, y1) be the coordinates of the other. The difference between the x's is dx = x1 - x0. The difference between the y's is similarly dy = y1 - y0. The line segment connecting the points can be thought of as the hypotenuse of a right triangle whose sides have lengths that are the absolute values of dx and dy. By Pythagoras' rule, the square of the hypotenuse is equal to the sum of the squares of the two other sides. So if xsquared = dx*dx and ysquared = dy*dy, then the distance is the square root of (xsquared + ysquared).
    As suggested in exercise 1 of Chapter 16, write a Python expression that will compute the Euclidean distance in this manner. For the values x0=0, y0=0, x1=3, y1=4, apply your formula using the Python Listener and write down the answer you get for the distance. With the other values the same, change x1's value to 4. Now what distance do you get?

Part 2

  1. In your new teams, create a team version of the previous problem, in which there is one demonstration of effects from all members of the team. There should be two transformations for each person. These should be new transformations, different from anything you have used before -- in other words "original." The form of the program should be as follows:
    pmMessage("Here are Sally's transformations.", "Sally", 400,300,220,100)
    # download Sally's image and show her transformations
    pmMessage("Now for John's transformations.", "John", 400,300,220,100)
    # download John's image and show his transformations
    pmMessage("Now for Jill's transformations.", "Jill", 400,300,220,100)
    # download Jill's image and show her transformations
    pmMessage("Now for Mark's transformations.", "Mark", 400,300,220,100)
    # download Mark's image and show his transformations
    
    Each person should include a copy of the team's file in their own Word document turned in. One member of the team should save a copy of the file using your team's name and upload it to INFACT, available to Group members.

    Solutions are now available.