Page 186 - DCAP504_Computer Graphics
P. 186

Unit 12: Color and Shading Model



               The figure 12.5 depicts a color cube.

                                                Figure 12.5: Color Cube


























               Now let us discuss how a color cube can be used to specify any color. Consider the example of Open
               Graphics Library (OpenGL).  OpenGL is  an Application Programming Interface (API) that helps  in
               defining 2-D and 3-D computer graphics.

               OpenGL uses the color cube as shown below:
               To draw-in red, OpenGL issues the following function call:
               glCo1or3f (l.0, 0.0, 0.0);
               The execution of glColor3f (1.0, 0.0, 0.0) function will set the current image color to red. The reason is
               that the color is part of the state where red color remains the same until color is changed.  The 3f is used
               to tell a program that we are using a tri-color (RGB) model.



                           Make a list of colors that can be generated by mixing blue and green, and blue and red.


               Hue, Saturation, and Intensity (HIS) Model
               Similar to light, even the color can be differentiated by three quantities such as hue, saturation, and
               intensity. The Hue, Saturation, and Intensity (HSI) color model is an effective tool for developing image
               processing algorithms depending on color descriptions that are natural and intuitive to the users who
               use those algorithms.

               Conversion from RGB to HIS can be done using the following equations:
               H=arctan (L/M)
                       2 1/2
               S= (L +M )
                    2
               I=N√3











                                        LOVELY PROFESSIONAL UNIVERSITY                          179
   181   182   183   184   185   186   187   188   189   190   191