[comp.graphics] filtering images

shirley@m.cs.uiuc.edu (12/06/89)

Only one  person responded to my badly phrased image filtering 
question, so I'm posting what I think the issues are from the
reading I've done lately.  If I have anything wrong or missing
please let me know.

You begin with an greyscale image f(x, y) defined over the window area, where
(x,y) are the real coordinates on the screen.  You eventually want
to display an image on a CRT, which represents the function as
(for a 1024 by 768 screen, where (x, y) range from (0.0...1024.0, 0.0...768.0)

                      1023 767
           f'(x, y) = SUM  SUM amplitude_k * gaussian(ix, jy, sigma)
                      i=0  j=0

here ix and jy are the center of pixel (i, j), amplitude_k is the kth 
setting of the D/A converter for the CRT (k usually varies from 0..255).
gaussian(x, y, sigma) is a 2D gaussian centered at (x, y) 
with SD sigma (sigma is adjusted for the monitor).
This approxiamtes the smear that the electronbeam draws for one pixel.

The best image will occur when f' looks the most like f.  This is 
perceptual, and is thus hard to quantify.

Where does signal processing and all the fourier transform stuff come in?
A common problem in signal processing is taking a function f(t), point sampling
it at regular intervals, transmitting it somewhere, and then reconstructing
it back to a continuous function.  There is a theorem that if f has no
frequency component above some limit, then it can be reconstructed 
exactly if the distance between samples is small enough.  There is also
a multidimensional extension of this idea.

In graphics we often regularly point sample the image function f(x, y)
and use the sample values directly for the amplitude_k.  This produces
jaggies.  The signal processing theory doesn't directly apply because
f is not limited to low frequencies (edges have infinitely high freq.
components).  We can get rid of the high freqency components in f by
convolving it a kernal k.  Convolution is really just replaces f(x)
with a weighted average of f at neighboring points.  The size of
the weights is given by the shape of the kernal k.  If k is a sinc(x),
then all the high frequencies will vanish, and the low freqencies will
be unchanged.  This new function can then be point sampled, and then
reconstructed exactly.  Unfortunately, this reconstruction requires
a sinc(x) reconstruction kernal, and we'll use a guassian (CRT spot).
So what we've done is approximated f with convole(f, sinc) and then
not displayed this correctly!  This can be seen in the ringing in 
images that use the sinc filter.

Another way to look at it is to use the average value of f within the
pixel square for amplitude_k.  This is mathematically equiv. to using`
a box filter kernal, though the idea is clear without the math.

This has just brushed the surface on this topic.  I (along with all the
papers I've seen) have ignored color.  It seems that the different 
channels have handled independently.

An introduction to this stuff is in Jim Blinn's Corner of CG&A Jan
and March '89.  A very advanced article that touches on everything is
Kajiya and Ullner's article in '81 SIGGRAPH.  The best book I've found
on signal processing is SIGNAL ANALYSIS AND ESTIMATION, AN INTRO. by
Ronald L Fante (Wiley 88).  The treatment of fourier analysis is
particularly clear.

pete shirley
shirley@m.cs.uiuc.edu