## Pat Hanrahan

3. The following questions concern color tables.

3A. (5 points) What are the advantages of using a color-index image and displaying it with a hardware color table?

• Natural representation for some images
• Less memory per image
• May remap colors quickly by changing the just changing the table
• May apply interesting transformations to the image (e.g. gamma correction)

Scoring:

5 points for any reasonable answer

3B. (5 points) What might be some disadvantages?

• Limited number of colors available
• Hardware color table needs to be shared between applications
• Cannot operate on the image colors directly (most 1st look them up)

Scoring:

5 points for any reasonable answer

3C. (5 points) Suppose an 8-bit in, 8-bit out, color table is used to gamma-correct an image. What problems might occur.

Gamma correction involves applying a non-linear function to color values (O=I^(1/gamma)). Since the range of the input and the output are the same (256 entries each), multiple input colors will map to the same output color, and thus there will be precision problems.

Scoring:

-2 points if you do not say "multiple inputs map to the same output" or equivalent.

3D. (10 points) Suppose you have a 24-bit RGB image. How might you convert it to an 8-bit color-index image? Describe two methods, comparing and contrasting them

Quantize the color value

1. Uniformly quantize the color space by assigning a certain number of bits to R, G, and B. For example, 3-bits for R, 3-bits for G, and 2-bits for B.
2. Pick any color table. Then for each color in the image, find the closest color to it in the color table and use the index of that color.
3. Find the 256 most popular colors in the image, and then map each color in the image to one of these colors.
4. Adaptively subdivide color space into 3-boxes, such that the number of pixels inside each box is equal. Then find the average color in each box and map all colors within that box to that color.

Apply a dithering or halftoning algorithms to the quantized colors to minimize the error.