# Homework 7 (Image Processing: noise-removal and sharpening)

AI and Robotics

Nov 6, 2013 (4 years and 8 months ago)

114 views

Polytechnic University, Dept. Electrical and Computer Engineering

EE3414 Multimedia Communication System I

Spring 2006
, Yao Wang

__________________________________________________________________________________________________

Homework 7

(Image Processi
ng: noise
-
removal
and sharpening
)

Gonzalez and Woods,
Digital image processing
, 2
nd

edition, Prentice Hall, 2002.
Sec.
4.3, 4.4
,
5.1

5.3

(copies provided)

1.

Assume the image in Fig. 1(a) is the original, and that in Fig. 1(b) is wit
h noise.
For the image block
in
Fig.1(b)
, determine the image obtained after a) an averaging filter with 3x3 pixel window, b) a median filter
with 3x3 pixel window. In both cases, you only need to determine the filtered values for pixels inside the
one
-
pix
el
-
width boundary (i.e. you don’t need to perform filtering for pixels in the top row, bottom row,
leftist and rightist columns).

You should leave the pixels along the boundary as is.

Also, you should round
the filtered value to integer values. By comparin
g

your results with the original image,
comment on the
capability of each filter in removing noise while preserving edges.

200

200

200

200

200

200

200

200

200

200

200

200

200

200

200

200

50

50

50

200

200

200

200

50

50

50

200

200

200

200

50

50

50

200

200

200

200

200

200

200

200

200

200

200

200

200

200

200

200

Fig. 1(a)

Fig. 1(b)

Filtered results with averaging filter:

200 200

200

200

200

200

200

200

186 169 150 167 183
200

200

169 137 101 133 166
200

200

150 101 51 100 149
200

200

166
134 102 133 164
200

200

182 167 151 167 182
200

200 200

200

200

200

200

200

Filtered results with median filter

20
0

200 200 200 200 200

20
0

200 200 200 200 200 200 200

200 200 200

50 190 200 200

200 200 50 50 50 200 200

200 200 190 50 190 200 190

200 200 200 200 200 200 200

20
0 200 200 200 200 200
20
0

We see that the median filter was able to preserve the
edges much better, while restoring corrupted pixels to
original values for many cases. The results with the averaging filter induces too much blurring across the edges.

200

200

200

200

200

200

200

200

200

210

200

190

210

200

200

210

50

50

50

200

200

200

200

50

60

50

190

200

200

190

50

50

50

200

200

200

200

200

210

200

190

200

200

200

200

200

200

200

200

2.

For the image given
in Fig. 1(a), apply the following filter

0
1
0
1
4
1
0
1
0
S

Determine the
filtered image. Comment on the function of the filter, both based on the filter function itself as
well as the filtered image.

You only need to determine the filtered values for pixels inside the one
-
pixel
-
width
boundary. You can set pixels

along the one
-
pixel
-
width boundary to 0 in the output image.

The filtered image is:

0

0

0

0

0

0

0

0 0

150 150 150 0

0

0 150
-
300
-
150
-
300 150 0

0 150
-
150 0

-
150 150

0

0 150
-
300
-
150
-
300 150 0

0 0

150 150 150

0

0

0

0

0

0

0

0

0

From the filter itself, we see that it basically takes the difference between each current pixel with the averaging
of

its four neighbors (top, bottom, left, right). So this is a high pass filter and has the effect of edge detection.
This is confirmed from the filtered image, which has higher output values (in magnitude) along the edges of the
original image.

3.

For the im
age given in Fig. 1(a), apply the following filter

0
1
0
1
8
1
0
1
0
4
1
S

Determine the filtered image. Comment on the function of the filter, both based on the filter function itself as
well as the filtered image.

You only need to determine the filtered

values for pixels inside the one
-
pixel
-
width
boundary. You should leave the pixels along the boundary as is.

The filtered image is

2
00 2
0
0 2
0
0 2
0
0 2
0
0 2
0
0
2
00

2
0
0 200 238 238 238 200 2
0
0

2
0
0 238
-
25 13
-
25 238

2
0
0

2
0
0 238 13 50 13 238 2
0
0

2
0
0 238
-
25 13
-
25 238 2
0
0

2
0
0 200 238 238 238 200 2
0
0

2
00 2
0
0 2
0
0 2
0
0 2
0
0 2
0
0
2
00

Because the filter has both positive and negative coefficients and sum to 1,

this is likely to be a sharpening filter
(In fact this is one of the example sharpening filters given in the lecture note). The filtered image indeed show
enhanced edges. For example, for the vertical edge between 2
nd

column to the third column, the value
s in the
second column are increased, and the values in the third column are decreased (for some of them), making the
transition more steep.