Grayscale and color representation
The framegrabber usually expresses the grayscale value of a pixel as an 8 bitnumber (1 byte of computer memory). This leads to 256 discrete values of
gray, with 0 representing black and 255 representing white. (Remember, 256
values means 0. . . 255.)
Color is represented differently. First, there are many differentmethods of
expressing color. Home PC printers use a subtractive method, where cyan
plus yellow make green. Most commercial devices in the U.S. use a NTSC
(television) standard. Color is expressed as the sum of three measurements:
RGB red, green, and blue. This is simply abbreviated as RGB.
COLOR PLANES RGB is usually represented as three color planes, or axes of a 3D cube as
shown in Fig. 6.11. The cubic represents all possible colors. A specific color
is represented by a tuple of three values to be summed: (R, G, B). Black is
(0,0,0) or 0+0+0, or no measurements on any of the three color planes. White
is (255, 255, 255). The pure colors of red, green, and blue are represented
by (255,0,0), (0,255,0), and (0,0,255) respectively. This is the same as in color
graphics.
Notice that the cube dimensions in the figure are 256 by 256 by 256, where
256 is the range of integers that can be expressed with 8 bits. Since there
are three color dimensions, a manufacturer may refer to this as 24-bit color
(3 x 8), to distinguish their framegrabber from ones which map color onto a
linear grayscale. The 8-bit color model is what is used to colorize old black
and white movies. There are only 256 values of color, which is quite limited,
and the gray values are often ambiguous. The pixel values of a person’s red
lips might be 185, while their dark blue dress is also 185. A person may
have to indicate which regions in each frame of the film where 185=red and
185=dark blue. 8-bit color is not often used for robots, unless the robot will
int image[ROW][COLUMN][COLOR_PLANE];
...
red = image[row][col][RED];
green = image[row][col][GREEN];
blue = image[row][col][BLUE];
display_color(red, green, blue);
2. Separate. Some framegrabbers store an image as three separate two-dimensional
arrays, as shown below. Some framegrabbers have functions
which return each color plane separately or interleaved. The equivalent
code fragment is:
int image_red[ROW][COLUMN];
int image_green[ROW][COLUMN];
int image_blue[ROW][COLUMN];
...
red = image_red[row][col];
red = image_green[row][col];
red = image_blue[row][col];
display_color(red, green, blue);
The RGB representation has disadvantages for robotics. Color in RGB is
a function of the wavelength of the light source, how the surface of the object
modifies it (surface reflectance), and the sensitivity of the sensor. The
first problem is that color is not absolute. RGB is based on the sensitivity
of the three color sensing elements to reflected light. An object may appear
to be at different values at different distances due to the intensity of the reflected
light. Fig. 6.12 shows the same program and parameters to segment
an orange landmark that is serving as a “flag” for tracking a small robot just
outside of the image. The RGB segmentation in Fig. 6.12a is more correct than
in Fig. 6.12b. The only difference is that the flagged robot hasmoved, thereby
changing the incidence of the light. This degradation in segmentation quality
is called visual erosion, because VISUAL EROSION the object appears to erode with changes
in lighting. Moreover, CCD devices are notoriously insensitive to red. This
means that one of the three color planes is not as helpful in distinguishing
colors.
Clearly a device which was sensitive to the absolute wavelength of the
reflected light (the hue) would be more advantageous than having to work
around the limitations of RGB. Such HSI a device would work on the HSI (hue,
HUE saturation, intensity) representation of color. The hue is the dominant wavelength
and does not change with the robot’s relative position or the object’s
SATURATION shape. Saturation is the lack of whiteness in the color; red is saturated, pink is
VALUE less saturated. The value or intensity measure is the quantity of light received
INTENSITY by the sensor. So HSV is a very different color scheme than RGB.
HSV is a three-dimensional space in that it has three variables, but it is definitely
not a cube representation, more of a cone as seen in Fig. 6.13. The hue,
or color, is measured in degrees from 0 to 360. Saturation and intensity are
real numbers between 0 and 1. These are generally scaled to 8-bit numbers.
Accordingly, red is both 0 and 255, orange is 17, green is at 85, blue is 170,
with magenta at 200.
HSV space is challenging for roboticists for many reasons. First, it requires
special cameras and framegrabbers to directly measure color in HSV
space. This equipment is prohibitively expensive. Second, there is a software
conversion from the RGB space measured by consumer electronics, but it is
computationally expensive and has singularities (values of RGB where the
conversion fails). These singularities occur at places where the three colors
for a pixel are the same; the flatness of the red color plane in CCD cameras
increases the likelihood that a singularity will occur.
An alternative color space that is currently being explored for robotics is
the Spherical Coordinate Transform(SCT). 140 That color space was designed
to transform RGB data to a color space that more closely duplicates the response
of the human eye. It is used in biomedical imaging, but has not been
widely considered for robotics. The shape of the color space is triangular,
as shown in Fig. 6.14. Initial results indicate it is much more insensitive to
changes in lighting.74 Fig. 6.15 shows an image and the results of segmenting
a color in RGB, HSI, and SCT spaces.

No comments:
Post a Comment