
90 A Computational Introduction to Digital Image Processing, Second Edition
Borders of the Image
There is an obvious problem in applying a filter—what happens at the border of the
image, where the mask partly falls outside the image? In such a case, as illustrated in
Figure 5.3 there will be a lack of gray values to use in the filter function.
FIGURE 5.3: A mask at the edge of an image
There are a number of different approaches to dealing with this problem:
Ignore the edges. That is, the mask is only applied to those pixels in the image for which
the mask will lie fully within the image. This means all pixels except for those along
the borders, and results ...