Next: 13.2.2 Pixel Scale and
Up: 13.2 Colors and Color
Previous: 13.2 Colors and Color
13.2.1 The Accumulation Buffer: Interpolation and Extrapolation
Haeberli and Voorhies [40] have suggested several interesting
image processing techniques using linear interpolation and extrapolation.
Each technique is stated in terms of the formula:
out = (1  x)*in_{0} + x*in_{1}

(12) 
This equation is evaluated on a perpixel basis. in_{0} and in_{1} are
the input images, out is the output image, and x is the blending
factor. If x is between 0 and 1, the equations describe a
linear interpolation. If x is allowed to range outside [0..1],
the result is extrapolation [40].
In the limited case where
,
these equations may be
implemented using the accumulation buffer via the following steps:
 tex2html_nowrap
38.
 Draw in_{0} into the color buffer.
 tex2html_nowrap
39.
 Load in_{0}, scaling by (1x) (glAccumGL_LOAD, (1x)(GL_LOAD, (1x))).
 tex2html_nowrap
40.
 Draw in_{1} into the color buffer.
 tex2html_nowrap
41.
 Accumulate in_{1}, scaling by x (glAccumGL_ACCUM,x(GL_ACCUM,x)).
 tex2html_nowrap
42.
 Return the results (glAccumGL_RETURN, 1(GL_RETURN, 1)).
It is assumed that in_{0} and in_{1} are between 0 and 1. Since the
accumulation buffer can only store values in the range [1..1], for
the case x < 0 or x > 1, the equation must be implemented in a
different way. Given the value x, you can modify equation
12 and derive a list of accumulation buffer
operations to perform the operation. Define a scale factor ssuch that:
s = max(x, 1x)
Equation 12 becomes:
and the list of steps becomes: tex2html_nowrap
43.
 Compute s.
 tex2html_nowrap
44.
 Draw in_{0} into the color buffer.
 tex2html_nowrap
45.
 Load in_{0}, scaling by
(glAccumGL_LOAD, (1x)/s(GL_LOAD, (1x)/s)).
 tex2html_nowrap
46.
 Draw in_{1} into the color buffer.
 tex2html_nowrap
47.
 Accumulate in_{1}, scaling by
(glAccumGL_ACCUM, x/s(GL_ACCUM, x/s)).
 tex2html_nowrap
48.
 Return the results, scaling by s (glAccumGL_RETURN, s(GL_RETURN, s)).
The techniques suggested by Haeberli and Voorhies use a degenerate
image as in_{0} and an appropriate value of x to move toward or away
from that image. To increase brightness, in_{0} is set to a black
image and x > 1. To change contrast, in_{0} is set to a gray image
of the average luminance value of in_{1}. Decreasing x (toward the
gray image) decreases contrast; increasing x increases contrast. Saturation
may be varied using a luminance version of in_{1} as in_{0}. (For
information on converting RGB images to luminance, see
Section 13.2.4.) Sharpening may be accomplished by setting
in_{0} to a blurred version of in_{1} [40].
Next: 13.2.2 Pixel Scale and
Up: 13.2 Colors and Color
Previous: 13.2 Colors and Color
David Blythe
19990806