Intensity Transformations and Spatial Filtering
Intensity Transformations and Spatial Filtering
Intensity Transformations and Spatial Filtering
performing the pixel-by-pixel sum of a sequence of images for noise reduction. Fig 3.1 shows
the basic implementation of Eq. (3.1-1) on a single image. The point (x, y) shown is an arbitrary
location in the image, and the small region shown containing the point is a neighborhood of (x,
y). Typically, the neighborhood is rectangular, centered on (x, y), and much smaller in size than
the image.
Fig 3.1 A 3 × 3 neighborhood about a point (x, y) in an image in the spatial domain. The neighborhood is
moved from pixel to pixel in the image to generate an output image.
The process that Fig. 3.1 illustrates consists of moving the origin of the neighborhood from pixel
to pixel and applying the operator T to the pixels in the neighborhood to yield the output at that
location. Thus, for any specific location (x, y), the value of the output image g at those
coordinates is equal to the result of applying T to the neighborhood with origin at (x, y) in f. For
example, suppose that the neighborhood is a square of size and that operator T is defined as
“compute the average intensity of the neighborhood.” Consider an arbitrary location in an image,
say (100, 150). Assuming that the origin of the neighborhood is at its center, the result, at that
location is computed as the sum of and its 8-neighbors, divided by 9 (i.e., the average intensity of
the pixels encompassed by the neighborhood). The origin of the neighborhood is then moved to
the next location and the procedure is repeated to generate the next value of the output image g.
Typically, the process starts at the top left of the input image and proceeds pixel by pixel in a
horizontal scan, one row at a time. When the origin of the neighborhood is at the border of the
image, part of the neighborhood will reside outside the image. The procedure is either to ignore
the outside neighbors in the computations specified by T, or to pad the image with a border of 0s
or some other specified intensity values. The thickness of the padded border depends on the size
of the neighborhood.
As we discuss in detail in Section 3.4, the procedure just described is called spatial filtering, in
which the neighborhood, along with a predefined operation, is called a spatial filter (also referred
to as a spatial mask, kernel, template, or window). The type of operation performed in the
neighborhood determines the nature of the filtering process. The smallest possible neighborhood
is of size.1 × 1. In this case, g depends only on the value of f at a single point (x, y) and T in Eq.
(3.1-1) becomes an intensity (also called gray-level or mapping) transformation function of the
form:
s = T(r) 3.1-2
Where, for simplicity in notation, s and r are variables denoting, respectively, the intensity of g
and f at any point (x, y). For example, if T(r) has the form in Fig. 3.2 (a), the effect of applying
the transformation to every pixel of f to generate the corresponding pixels in g would be to
produce an image of higher contrast than the original by darkening the intensity levels below k
and brightening the levels above k. In this technique, sometimes called contrast stretching values
of r lower than k are compressed by the transformation function into a narrow range of s, toward
black. The opposite is true for values of r higher than k. Observe how an intensity value is
mapped to obtain the corresponding value. In the limiting case shown in Fig. 3.2 (b), T(r)
produces a two-level (binary) image. A mapping of this form is called a thresholding function.
Some fairly simple, yet powerful, processing approaches can be formulated with intensity
transformation functions. Here, we use intensity transformations principally for image
enhancement. Approaches whose results depend only on the intensity at a point sometimes are
called point processing techniques, as opposed to the neighborhood processing techniques.
Fig 3.2 Intensity transformation functions. (a) Contrast-stretching function. (b) Thresholding
function.
Fig 3.3 Some basic intensity transformation functions. All curves were scaled to fit in the range
shown.