CS 248: Introduction to Computer Graphics
Pat Hanrahan
Grader: 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
-
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.
-
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.
-
Find the 256 most popular colors in the image, and then map each color
in the image to one of these colors.
-
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.
Some comments on comparisons:
-
4) is the best method since the error will be minimized, 3) is also
quite good although it has the disadvantage that some of the most
common colors may be near each other.
-
2) will work well if the colors in the color table match the colors in
the image, otherwise it is a poor choice
-
1) is a good default, and widely used in many systems
-
Dithering can be used with any color quantization method to minimize
the error.
Scoring:
4 points for any reasonable method (8 points total)
2 points for correctly comparing them
Copyright © 1997 Pat Hanrahan