Digital Signal Processing Reference
In-Depth Information
Solution:
Step 1: The 3 3 kernel requires zero padding 3/2 ¼ 1 column of zeros at the left and right edges and 3/2 ¼ 1 row
of zeros at the upper and bottom edges:
0
00
0
0
0
0
100
255 100 100
0
0
0
0
0
0
100
255
255 100 100
100
100
0
100
100 100
100
0
0
00
0
0
0
Step 2: To process the first element, we cover the 3 3 kernel with the center pointing to the first element to be
processed. The sorted data within the kernel are listed in terms of thier value as
0; 0; 0; 0; 0; 100; 100; 255; 255
The median value ¼ median(0, 0, 0, 0, 0, 100, 100, 255, 255) ¼ 0. Zero will replace 100.
Step 3: Continue for each element until the last is replaced. Let us review the element at location (1,1):
0
00
0
0
0
0
100
255 100 100
0
0
0
0
0
0
100
255
255 100 100
100
100
0
100
100 100
100
0
0
00
0
0
0
The values covered by the kernel are
100; 100; 100; 100; 100; 100; 255; 255; 255
The median value ¼ median(100, 100, 100, 100, 100, 100, 255, 255, 255) ¼ 100. The final processed
image is
2
4
3
5
0 100 100 0
100 100 100 100
0 100 100 0
100 100 100 100
Some boundary pixels are distorted due to the zero padding effect. However, for a large image, the portion of the
boundary pixels (outmost image edges) is significant small so that their distortion can be omitted versus the overall
quality of the image. The 2 2 middle portion matches the original image exactly. The effectiveness of the median
filter is verified via this example.
The image in Figure 14.27A is corrupted by “pepper and salt” noise. The median filter with a 3 3
kernel is used to filter the impulse noise. The enhanced image shown in Figure 14.27B has a significant
quality improvement. Note that a larger size kernel is not appropriate for median filtering, because for
a larger set of pixels the median value deviates from the pixel value.
 
Search WWH ::




Custom Search