Académique Documents
Professionnel Documents
Culture Documents
x[m, n] n y[m, n] n
m m
fuzzy perception when local intensity is smooth. A simple smoothing operation involves
replacing each pixel by its average over a local region as shown in Figure 2.23.
Consider a 3 × 3 region around the pixel x[m, n]. Then the smoothed pixel value y[m, n]
can be computed as an arithmetic mean of the nine pixels in the local region
1 1
1
y[m, n] = x[m − k, n −
]. (2.74)
9
k=−1
=−1
which can be seen as an FIR spatial filter impulse response. Then we can write (2.74) as
1
1
y[m, n] = h[k,
]x[m − k, n −
], (2.76)
k=−1
=−1
which is a 2D convolution of image x[m, n] with an FIR spatial filter h[m, n]. A general
expression for 2D convolution, when the FIR spatial filter has finite symmetric support
(2K + 1) × (2L + 1), is given by
K
L
y[m, n] = h[k,
]x[m − k, n −
]. (2.77)
k=−K
=−L
Figure 2.23 shows the result of a 5 × 5 smoothing filter operation on the image Lena.
61 2.10 Systems described by linear constant-coefficient difference equations
+
+
+
I
u
u I¢
m+K
n+L
y[m, n] = x[k,
]h[m − k, n −
]. (2.78)
k=m−K
=n−L
This suggests the following steps for the computation of convolution at each pixel [m, n]:
1. The filter array h[k,
] is rotated by 180◦ to obtain h[−k, −
] array.
2. The rotated array is moved over the image so that the origin h[0, 0] coincides with the
current image pixel x[m, n].
3. All filter coefficients are multiplied with the corresponding image pixels and the results
are added.
4. The resulting sum is stored at the current pixel [m, n] in the filtered image y[m, n].
These steps are shown in Figure 2.24 which pictorially illustrates the convolution opera-
tion. The M ATLAB function y=conv2(h,x) implements the 2D convolution operation in
(2.78). However, the more suitable function for FIR spatial filtering is y=filter2(h,x)
which uses the conv2 function but provides the output sequence y with the same size as
that of the input sequence x. Using different shapes and values for the FIR filter support,
various visual effects like motion-blur, edge detection, edge enhancement, etc. can be
obtained. These and other issues are examined in Problems 15, 16, and 46.
We have shown in Section 2.4 that every linear time-invariant system (1) is uniquely
characterized by its impulse response sequence, and (2) its output can be determined