next up previous contents
Next: CMY Conversion Up: 12.2.4 The Color Matrix Previous: Modifying Saturation

Hue Rotation

Changing the hue of a color may be accomplished by loading a rotation about the gray vector (1, 1, 1). This operation may be performed in one step using the glRotate() command. The matrix may also be constructed via the following steps [26]:

Unfortunately, a naive application of glRotate() will not preserve the luminance of the image. To avoid this problem, you must make sure that areas of constant luminance map to planes perpendicular to the z axis when you perform the hue rotation. Recalling that the luminance of a vector (R, G, B) is equal to:
displaymath11240
you realize the plane of constant luminance k is defined by:
displaymath11241
Therefore, the vector tex2html_wrap_inline11258 is perpendicular to planes of constant luminance. The algorithm for matrix construction becomes the following [26]: It is possible to compute a single matrix as a function of tex2html_wrap_inline11204, tex2html_wrap_inline11206, tex2html_wrap_inline11208, and the degrees of rotation which performs this operation.