Page 238 - Introduction to AI Robotics
P. 238

6.6 Computer Vision
                                                                 Blue              Cyan               221
                                                               (0,0,255)          (0,255,255)


                                                     Magenta              White
                                                     (255,0,255)        (255,255,255)




                                                                 Black              Green
                                                                 (0,0,0)            (0,255,0)



                                                       Red                Yellow
                                                      (255,0,0)          (255,255,0)


                                                            Figure 6.11  RGB color cube.



                                      be operating in an environment where the only visible colors will not have
                                      an ambiguity.
                                        24-bit color is usually sufficient for robotics. For other applications of com-
                                      puter vision such as medical imaging, weather forecasting, or military re-
                                      conaissance, an 8 bit resolution is often insufficient. Those applications may
                                      use 10 bits for each color plane. Since 10 bits do not fall on a byte boundary,
                                      it can be awkward to program algorithms for representing and manipulat-
                                      ing this kind of image. Companies such as Pixar make special computers for
                                      these applications.
                                        In programming terms, 24-bit color image is often declared in computer
                                      programs in two ways:

                                      1. Interleaved. Interleaved means the colors are stored together, RGB RGB
                                         RGB ..., and it is the more common representation. The order is almost
                                         always red, green, then blue, although there may be framegrabbers which
                                         do not follow that convention. Below is a code fragment where the color
                                         is displayed for a pixel at location row, col.

                                         #define    RED   0
                                         #define    GREEN 1
                                         #define    BLUE 2
   233   234   235   236   237   238   239   240   241   242   243