Page 239 - Introduction to AI Robotics
P. 239

222
                                                                  6 Common Sensing Techniques for Reactive Robots
                                        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-di-
                                        mensional 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 ob-
                                     ject 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 re-
                                     flected 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 has moved, thereby
                                     changing the incidence of the light. This degradation in segmentation qual-
                      VISUAL EROSION  ity is called visual erosion, because 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
   234   235   236   237   238   239   240   241   242   243   244