Graphics Reference
In-Depth Information
the exponential term to maintain several desirable properties, such as having the integral of
the function over the entire input domain be 1:
(10.2)
The only changing variables in this equation are the x and y locations of the sample.
So, the output filter weightings can be regarded as spatial in nature, since the only in-
put into the equation for generating the weights is based on the spatial orientation of the
samples. In general, the farther from the center of the filter a sample is, the smaller its
resulting weighting on the overall result of the filtered pixel will be. The shape of the filter-
ing kernel can be modified with the constant sigma parameter. Depending on the chosen
value of sigma, the amount of blurring can be increased or decreased. The larger the sigma
value, the greater the blur that is applied to an image. In Figure 10.5, we can see how an
increasingly large sigma value will produce a progressively greater amount of blurring by
examining the shape of the filter kernel.
Equation (10.2) can be used to produce the desired set of filter weights for a filter
kernel of more or less any size. Since we can't use infinitely sized kernels, we would typi-
cally choose an appropriate filter size for the operation being implemented, to produce the
appropriate image quality. With a truncated filter kernel size, we can eliminate the constant
term from Equation (10.2), since it assumes an infinite input domain. Instead, we will cal-
culate the filter weights at each filter kernel location and then renormalize their total weight
by dividing each filter weight by the sum of all of the weights. This maintains the integral-
of-1 property with a more computationally friendly filter kernel size. This is required to
ensure that the total energy contained within the image signal remains the same before and
after the blurring is performed. 1
The Gaussian filter is used in many areas. Typical uses include performing image blur
effects such as blooming, and performing up- and down-sampling operations. In addition,
many non-rendering applications also use the Gaussian-filter, such as a blur operation being
performed prior to a dilation operation in a character recognition system.
10.2.2 Implementation Design
The basic implementation of the Gaussian filter is relatively simple. The desired filter ker-
nel is filled in with values generated by the Gaussian function with a sigma value chosen for
the desired level of blurring. This is typically done at design time, so that the filtering ker-
nel is not recalculated for every pixel being processed; but if a dynamic filter size is needed,
1 It is possible to simultaneously achieve other effects by changing this total filter weight as well. For example,
if the kernel weights sum to a value less than or greater than 1.0, the resulting image will be either darkened or
brightened, respectively.
Search WWH ::




Custom Search