Graphics Reference
In-Depth Information
but I need to interpolate colors along the edges and at the interior points”). Unfor-
tunately, this isn't easy. For colors that are very similar (e.g., when their difference
is just a little more than the just-noticeable difference), almost any interpolation
scheme will work, including interpolating the RGB coefficients (or whatever other
tuples you might be using to represent the colors). But for distant colors (e.g., a
saturated green and a medium-brown), there are many possibilities, and no one of
them is right for all circumstances.
You can even show that certain reasonable assumptions about color inter-
polation cannot be met by any interpolation scheme on any three-dimensional
color space.
If, for instance, one insists
• That the color C (
α
, C 1 , C 2 ) , interpreted as “
α
of the way between colors
C 1 and C 2 ,” be a continuous function of
α
, C 1 , and C 2 , and should be C 1
= 1
• That two colors of equal saturation and brightness should be interpolated
by intermediate colors of equal saturation
• And that the color interpolated as “
when
α
= 0 and C 2 when
α
α
of the way from C 1 to C 1 ” should
always be C 1
then one has a contradiction. If we restrict our attention to colors of saturation
1 and brightness 1, we have a circle, which we'll denote S 1 , and which we'll
parameterize by hue, ranging from 0 to 1 (so a hue of 0 and a hue of 1 both denote
totally saturated red, for example). Restricting the function C to just this circle
gives a function from [ 0, 1 ]
S 1
S 1 to S 1 ; the properties above translate to
×
×
S 1
S 1
S 1 is continuous
C :[ 0, 1 ]
×
×
S 1
C ( 0, x , y )= x for all x , y
S 1
C ( 1, x , y )= y for all x , y
S 1
C (
α
, x , x )= x for all x
Now consider the functions
S 1 : t
p 0 :[ 0, 1 ]
C ( 0, 0, t ) , and
S 1 : t
p 1 :[ 0, 1 ]
C ( 1, t , t ) .
The second property tells us that p 0 is a constant, that is, its winding number
around the circle is zero. The final property tells us that p 1 wraps once around
the circle. But these two loops can be joined together by a family of intermediate
curves,
S 1 : t
p s :[ 0, 1 ]
C ( s , st , t ) , s
[ 0, 1 ]
each of which starts and ends at the same place. This is impossible, for t
p s ( t )
is a continuous function of both s and t , and hence the winding number of p s is a
continuous function of s . But a continuous integer-valued function is constant, so
the winding number cannot change from 0 to 1 as we vary s .
This is not to say that color interpolation is impossible or wrong; it merely
indicates that many seemingly natural constraints cannot be met. It's therefore
often best to carefully consider the application domain, and ask what's actually
needed: Do you really need to be able to interpolate between colors of opposite
hue without passing through white? Will the colors you're interpolating between
Search WWH ::




Custom Search