Lab Assignment

Write one program to generate five test images.

Image A1: Vertical Mach Bands

Create a 512x512 image that contains eight vertical bands. Each band should have the same width, and have uniform intensity. The bands should increase linearly in brightness from left to right (i.e., the band on the left should have an intensity of zero; the band on the right should have an intensity of 255).

Image A2: Horizontal Mach Bands

Transpose Image A1 to get an image with horizontal mach bands, with the darkest band on the top, and brightest band on bottom.

Image B: Sinusoid Grating

Create a 512x1024 image by sampling a sinusoid grating. The sinusoid should vary in frequency linearly from 0 to pi/3 from left to right, and its amplitude should vary linearly from maximum (127.5) to minimum (0) from top to bottom.

Image C: Boxes

Create a 512x1024 image containing four squares:

In this framework, try the following:

  1. Set B1 = B2 = X, where X is any value. This sets both small squaress to the same intensity.

  2. Fix S1 at a value sufficiently different from X (where you can perceive a difference between them).

  3. Vary S2. This demonstrates the effects of Simultaneous Contrast.

    Also try all combinations of intensities 0, 128, and 255 for X and S1 (where X is not equal to S1) for a total of 6 combinations. For each combination try several values of S2.

    You may want to turn off the light for this experiment so that the environment surround has the same brightness as the image surround.

Image D: More Boxes

Create a 512x512 image with the following properties

In this framework, try the following:
  1. Set F = I, then slowly increase F until you can just notice the difference between F and I. Let dI = F - I.

    Find dI for I=0,10,20,...,250.

    Again, a dark environment may be needed for you to perceive the full effect when your screen surround is dark.

  2. Plot F vs I and dI/I vs ln(I) to illustrate Weber's law. Include tables of your values along with the plots.