Assignment #1

Due to: Fr. Sept. 26th
Score: 5 points

1.
Write a program, that loads a color image from a file into memory, such that it is available to you as a 3d matrix consisting of the R,G and B values. (We will talk in the lab about programming language and libraries necessary.)

Here's the image you should use:

(download this image with explorer: right click, save target as...)

2.
Now change this picture:
convert it to a grayvalue-image by computing the average of the R,G and B value for each single pixel. Note: A grayvalue-image can be represented as a 2d Matrix, but you can also keep the 3d matrix, setting R,G and B all to the same value.

3.
Change the picture again, this time the result will be a color-image:
Replace the R,G,B values of each single pixel with the values r,g,b, computed by the following formula:

for each pixel do:
s=R+G+B+1;
r = R/s;
g = G/s;
b = B/s;

The result will look like the right picture (i additionally enhanced the brightness a bit):

What are the properties of this new image ?
Especially: what happens to regions of same color, but difference brightness ?
(we'll talk about color and brightness in the class, just take it intuitively first)

4.
Create a Pop-Art Version of the image loaded, which is again a color-image:
Replace the R,G,B values of each single pixel with the values r,g,b, computed by the following formula:

for each single pixel do:
search the maximum component of R,G and B, e.g. if the pixels color is: R=100, G=50, B=240, the max. component is B=240.
set the max. component to 255 if it is greater than 70 (try some other values !), else to 0.
set the other 2 components to 0.
Example: a pixel defined by (R,G,B) = (100,152,140) will be changed to (0,255,0)

The result will look like this

What are the properties of this new image (except that it looks great !) ?
Especially: how many colors does the new image have ?
Does it make sense to encode it as R,G,B full 24 bit ?