Homework 2

Spectral Image Function Sampling

Given the spectral image function L and tables for x_bar, y_bar, and z_bar, I computed the CIE tristimulous responses for each pixel. I used linear interpolation to find values of the "bar" functions at wavelengths between the given ones. I then transformed the tristimulous values using a matrix that assumes a standard NTSC monitor:

1.967 -0.955 0.064

-0.548 1.938 -0.130

-0.297 -0.027 0.982

(from Glassner, Principles of Digital Image Synthesis, Vol. I). Finally, I transform these values into valid RGB values [0,255] using several different transformation functions.

Transformation 1

Clamp all out-of-bounds values, e.g. -312 -> 0, 443 ->255.

Transformation 2

Scale each pixel by the images's minimum and maximum values. Each pixel = 255 * (original_pixel_value - min) / (max - min). The grayish background is an artifact of this - everything is shifted toward white, including pixels that were black.

Transformation 3

Similar to Transformation 2, but compress only that part of the input range for each color component that is out of range.

Transformation 4

Clamp negative values to 0, scale positive values by the image's maximum value.

Transformation 5

Scale each value by the image's maximum, then take the absolute value. Similar to Transformation 4, but no clamping.

Transformation 6

This doesn't work that well. It's a linear mapping of [min,0] -> [0, epsilon] and [0,max] -> [epsilon, 1]. It's not a smooth function, which explains the dark lines and odd washout effects. The images below show the transformation with epsilon = 0.1, 0.2, and 0.243847, this last being computed as | min / (max - min) |, making the intervals [0, epsilon] and [epsilon, 1] correspond to the relative values of min and max.