Assignment 1: "A Primer on PixelMath and Python" in CSE 190D (Spring 2013)

Purposes:

Gain familiarity with the PixelMath interface and basic Python programming, and reflect on images and human vision.
 

Format:

Prepare a document either in Word or PDF format that includes the images described in the problems. Each Python program that is requested in Part II should be in a separate file, each having the file extension ".py".
 

Due:

Sunday, April 7, via Catalyst CollectIt, at 11:00 PM.
 

Part I (Using the PixelMath Calculator):

Select an original color image that you will use for this part. Ideally, this will be a digital photograph that you have taken, for which you have all rights, so that if you wish, later, to show publicly any images derived from this, there will be no legal problems. If you like, you can use the same image for each of the following exercises, but you are also free to use different images for each one. In each case, show the image before and the image afterwards, and show whatever formula you use next to each example.
  1. Create a black-and-white (actually grayscale) monochrome image from your color original.
  2. Create a sepia-tone monochrome image.
  3. Increase the contrast of your image, so that there is a quite noticeable, but not drastic, change.
  4. Average two images to obtain a third. The second original may be geometrically transformed version of your first. The two input images should have the same dimensions.
  5. Use the Chroma-key technique to create an image that puts you into a new background. In order to prepare your personal portrait for this, create an image of the same size as your background image (which might be your original from the above exercises), and make it light blue -- the same shade of blue as the background of your UW ID portrait. Insert your UW ID portrait into the center of this blue image, such that the bottom of your portrait lines up with the bottom of the new imame.

Part II (Working with Python):

Start up PixelMath and open the Python window.
  1. Create a Hello World program that prints something funny. You should name the program something like HelloPythonWorld.py and make it a separate file.
  2. Create a program that loops 10 times, incrementing the value of a loop variable i, and does something (arithmetically) with each value of i and prints the result. The results should not all be constant or just equal to i.
  3. Create a program that does the following. First, it reads in an image (such as the one you used at the beginning of Part I). It should used the pmOpenImage command of Python in PixelMath. Then it should draw a box (outline only, not filled) centered on the image's center, whose height and width are each 1/3 of those of the image. It should do its drawing of the sides of the box using looping, and writing individual pixels with the command pmSetPixel.

Part III (Reading and Thinking):

Read Chapter 1 of the textbook. Then do the following exercises and questions.
  1. Exercise 1 on page 19.
  2. Exercise 4 on page 20.
  3. Have you ever experienced phosphenes? (A phosphene is a kind of perception of light or a pattern, typically when your eyes are closed and it is dark.) If so, describe the sensation. Have you ever experience pareidolia? If so, describe that experience. If you haven't experienced either of the above, find an example of apophenia, either in an image you have, or in an image you find on the web, and then include a copy of that image here, and describe the interpretation of the image that corresponds to the apophenia effect.