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 grey 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:[18]

Unfortunately, a naive application of glRotate() will not preserve the luminance of the image. To avoid this problem, we must make sure that areas of constant luminance map to planes perpendicular to the Z axis when we perform the hue rotation. Recalling that the luminance of a vector (R, G, B) is equal to:
displaymath7995
we realize the a plane of constant luminance k is defined by:
displaymath7996
Therefore, the vector tex2html_wrap_inline8007 is perpendicular to planes of constant luminance. The algorithm for matrix construction becomes the following:[18] It is possible to compute a single matrix as a function of tex2html_wrap_inline7959, tex2html_wrap_inline7961, tex2html_wrap_inline7963, and the degrees of rotation which would perform the operation.



David Blythe
Thu Jul 17 21:24:28 PDT 1997