C481 B581 Computer Graphics
Dana Vrajitoru
Homework 1
Due date: Wednesday, January 19.
Ex. 1 (15 points) Given the following table of correspondence
between the RGB and HSV systems, write a pseudocode function to convert
one of them into the other one (which ever you find simpler).
| Color |
Aspect |
RGB |
HSV |
| black |
|
0, 0, 0 |
0, 0, 0 |
| white |
|
1, 1, 1 |
0, 0, 1 |
| gray |
|
0.3, 0.3, 0.3 |
0, 0, 0.3 |
| red |
|
1, 0, 0 |
0, 1, 1 |
| yellow |
|
1, 1, 0 |
60, 1, 1 |
| green |
|
0, 1, 0 |
120, 1, 1 |
| cyan |
|
0, 1, 1 |
180, 1, 1 |
| blue |
|
0, 0, 1 |
240, 1, 1 |
| magenta |
|
1, 0, 1 |
300, 1, 1 |
| light blue |
|
0.6, 0.6, 1 |
240, 0.4, 1 |
| light orange |
|
0.9, 0.5, 0.3 |
20, 0.67, 0.9 |
Hint:
0.67 = 1 - (0.3 / 0.9)
20 = 0 + (0.5 - 0.3) * 60 / (0.9 - 0.3)
Ex. 2 (5 points) In this exercise you will experiment with image
representation and color
-
Retrieve an image from any source (web, scanner)
-
Open the image with the Gimp program under Linux and turn its color
mode into RGB (true color) with right click -> Image menu ->Mode. Save
the file as a bitmap or TIFF file. Modify the colors using the HSV
mode (right click -> Image menu ->Colors -> Hue-Saturation). You can
find the Gimp either from the Gnome menu under Graphics or something
similar, or by typing the command gimp.
-
Set the color mode of the image as indexed (256 colors). Experiment with
the color maps available under the Gimp. Note that for better results,
you should undo each color mode transformation from RGB to indexed before
applying another color map. Save the results you like as gif files.
-
Open the original image again and save it as a JPEG file.
-
Compare the sizes of all of these files.
Turn in: ex. 1 written or by email and image files from ex. 2
by email.