|
|
|
Week 3, 9/11
Prelab Exercises
- Complete problems 1-5 from WordCount in-class problems. Turn
the answers in (on paper) at the beginning of lab.
- Review the first page of a tutorial
on computational representations of colors and
the API for the
java.awt.Color class.
Lab Exercises
Snarf the pixmap project frpm the course
assignment folder.
- Review 2D array manipulation:
-
Review the
execute method in Command.java. What does it do?
- How do the transform methods in Brighten, Darken, GreyScale, Negative,
Posterize, and WeightedGreyScale relate to the one in
Command?
- Colors
After referring to the first page of a tutorial
on computational representations of colors and
the API for the java.awt.Color class, answer the following questions.
- Why is RGB a good representation for representing colors on a computer
monitor (instead of CMYK, for example)?
- Given 256 different levels each of red, green, and blue,
approximately how many colors can be represented?
- How are grey values represented in the RGB color space?
- Pixmap Transforms:
- Negative
Create a photographic negative of the image by inverting each of the three
RGB components of the current color. For example, if the
current color has the values (255, 0, 128) for its red, green,
and blue components, respectively; then the resulting color
should have the values (0, 255, 127) for its red, green, and
blue components. In other words, each value is the other's
opposite within the range of possible values from 0
.. 255. Thus, if this operation is performed on an image twice
in succession, the image would appear unchanged.
- Darken
Darken the image by reducing the values of each of the three RGB components
of the current color by some amount (like the darker method of
Java's Color class). Do not call the method, instead you will
try to reproduce its effects by manipulating the three RGB
components of the current color directly. Note, this method
should exactly undo the results of performing the Brighten
action (as long as any of the image's colors are not already as
bright as possible), so that doing one operation then the other
should result in no net change in the image. Be careful not to
produce a color value outside the range of possible values from
0 .. 255.
- Brighten
Brighten the image by increasing the values of each of the three RGB
components of the current color by some amount (like the
brighter method of Java's Color class). Note, this
method should exactly undo the results of performing the Darken
action (as long as any of the image's colors are not already as
dark as possible), so that doing one operation then the other
should result in no net change in the image.
- Posterize
Create a posterized version of the image by reducing its total number
of colors. To do this, you should restrict the values each of the
three RGB components of the current color can be. Specifically, if
the value of a component is between 0 and 63 inclusive, it should
be set to 49; if the value of a component is between 64 and 127
inclusive, it should be set to 98; if the value of a component is
between 128 and 191 inclusive, it should be set to 147; and if the
value of a component is between 192 and 255 inclusive, it should be
set to 196. In this way, the 256 possible values each component can
have is resticted to just 4.
- GreyScale
Create an image that has only shades of grey values by computing the
average value of the current color's three RGB components and using
that average value for all three components of the new color. For
example, if the current color has the values (255, 0, 128) for
its red, green, and blue components, respectively; then the resulting
color should have the values (127, 127, 127) for its red,
green, and blue components.
- Weighted GreyScale
Create an image that has a "better" greyscale transformation.
such that it uses the weights suggested in
this
article and see if you notice a
difference in the image quality. The main idea of the article
is to weight the three color components differently, i.e., create a
grey scale value based on taking 30% of the red component,
59% of the green component, and 11% of the blue component. For
example, if the current color has the values (255, 0, 128) for
its red, green, and blue components, respectively; then the resulting
color should have the values (90, 90, 90) for its red,
green, and blue components.
Submit
For this lab, the Brighten, Darken, Negative, Posterize, GreyScale, and WeightedGreyScale will
NOT be due now. Instead, they will be due at the same time
as the rest of the Pixmap assignment.
For this lab, submit:
- The answers to question 1 and 2 (Colors) above in a file called
lab03.txt
- A README.txt file including your name, NetID, collaborators,
resources used, and how many of the functions (Brighten, Darken, Negative, Posterize, GreyScale, and
WeightedGreyScale) you finished during the lab period.
|