Graphics Reference
In-Depth Information
line is near the edge of the “tent,” while the center-pixel contribution is larger.
Notice that the sum of the weighting functions is the constant function 1, so no
matter where we place the object, its total contribution to image brightness will be
the same.
We can express the weighted-area-overlap approach to determining pixel val-
ues mathematically. Let's suppose that x
f ( x ) is the function shown in Fig-
ure 18.16 whose value is 1 for any point x within our object, and 0 elsewhere. And
let's suppose that the red tent-shaped function in Figure 18.16 is called x
g ( x ) .
Then the value we assign to the center pixel is given by
g ( x ) f ( x ) dx .
(18.1)
Figure 18.14: A grayscale ren-
dering of a letter “A” (from a dif-
ferent font).
−∞
The value assigned to the next pixel to the right, whose weighting function is
just g shifted right one unit, is
f ( x ) g ( x
1 ) dx .
(18.2)
−∞
A similar expression holds for every pixel: The values we're computing are
generated by multiplying f with a shifted version of g and then integrating. This
operation—point-by-point multiplication of one function by a shifted version of
another, followed by integration (or summation, in some cases)—appears over and
over again in both graphics and mathematics and is called convolution, although
we should warn you that the proper definition includes a negation so that we end
up summing things of the form f ( x ) h ( i
x ) ; this negation leads both to conve-
nient mathematical properties and to considerable confusion. Fortunately for us,
in almost all our applications the functions that we convolve against have the prop-
erty that h ( x )= h (
x ) , so the negative sign has no impact.
In the next section, we'll discuss various kinds of convolutions, their applica-
tions in graphics, and some of their mathematical properties.
The remainder of this chapter consists of applying ideas from signal process-
ing to computer graphics. In that context, functions on the real line (or an interval)
are often called signals (particularly when the parameter is denoted t so that we
can think of f ( t ) as a value that varies with time). Convolving with a function
like the “tent function” above, which is nonzero on just a small region, is called
applying a filter or filtering, although the term can be used for convolution with
any function.
Figure
18.15:
A
small
object
moves
left
to
right
through
a
sequence of three pixels.
y
=
f ( x )
Figure 18.16: Weighted area
measurement. The central red
“tent-shaped” function is used as
a weight for contributions to the
center pixel.
18.3 Convolution
As we said already, convolution appears over and over again in graphics and the
physical world. Nearly every act of “sensing” involves some sort of convolution,
for instance. For example, consider one row of sensor pixels in an idealized digital
camera. We'll say that the light energy falling on the sensor at location ( x , y ) in
one second is described as function S ( x , y ) , and that S is independent of time.
The camera shutter opens for one second, and each pixel accumulates arriving
energy over that period of time, after which an accumulated value is recorded
as the pixel's value. But each pixel sensor—say, the one at pixel ( 0, 0 ) —has a
responsivity function, ( x , y )
1
4
0
2
2
1
0
1
2
0
3
4
5
Figure 18.17: Sensor pixels in a
digital camera, and the sensitivity
function M for pixel ( 0, 0 ) .
M ( x , y ) , that tells howmuch pixel response there is
for each bit of arriving light (see Figure 18.17). We're being deliberately informal
 
 
 
Search WWH ::




Custom Search