1
Digital Image Processing
Midterm Exam
November 9, (Tue.), 2010
Name: _______________________________________
Student ID: ___________________________________
Email Address: ________________________________
Notes:
1. Exam duration: 150 minutes (from 2:20pm – 4:50pm.)
2. Open-book exam (books, lecture notes, graded homework,
etc.)
3. One-line calculator.
4. Show all answers on sheets.
Problem Weight Score
1 7
2 15
3 17
4 13
5 20
6 14
7 14
Total 100
2
Problem1 (7 points)
(True or false) You will get -1 points for each wrong answer as penalty
(a) We can reconstruct the original image from its skeletonizing image since the
skeleton is preserved.
(b) The kernel [-1 2 -1] is meant to approximate first order derivative.
(c) Rotate P(x,y) by an angle θ clockwise with respect to the reference point R(u,v).
The resulting position is:
P’( cosθ(x-u)-sinθ(y-v)+u, sinθ(x-u)+cosθ(y-v)+v ).
(e) There are 4 connected components in the figure below. (4-connected rule for
object and 8-connected rule for background)
(f) Mean-square-error is a good criterion for measuring the quality of halftoned image.
(g) K-means algorithm is a supervised classification method.
(h) More features will lead to a better classification result.
3
Problem2 (15 points)
Suppose that the gray scale is of range [0, 9] instead of [0, 255].
(a) (2 point) Please plot the histogram of the following 8x8 image.
0 5 7 7 5 8 7 8
7 2 6 2 6 5 6 8
6 9 7 7 0 7 2 7
6 6 1 7 6 7 7 5
9 6 0 7 8 2 6 7
2 8 8 2 7 6 7 8
7 3 2 6 1 7 5 8
9 9 5 6 7 7 7 7
(b) (5 points) Please perform histogram equalization of the above image according to
the formula:
T�x� � round � cdf�x� � cdf���N � N � cdf���� � �L � 1��, � x: pixel value N: image size L: max gray scale value* Please output the resultant image and its corresponding histogram.
(c) (2 points) What will happen if we apply histogram equalization to the result of (b)
again?
(d) (2 points) Can histogram equalization always provide a better result? State your
reasons.
(e) (4 points) “Histogram matching” is a useful contrast manipulation technique
which transforms an image’s histogram to match the one of another image.
Please describe clearly how you achieve it.
5
Problem3 (17 points)
Fig. 3-1 Fig3-2
(a) (12 points) Please write down how you wrap Fig. 3-1 to Fig. 3-2 explicitly.
The flower shape can be described by the formula
r � 16 , 240 cos�4θ� , 0 r � 1x2 , y2 θ � tan45�y/x�* (b) (3 point) While finding the corresponding coordinates, we may choose forward
treatment or backward treatment. Is forward treatment better than backward
one? Explain your reasons.
(c) (2 point) Can we perfectly wrap Fig. 3-2 back to Fig. 3-1 since the exact wrapping
function is given? Why or why not?
7
Problem4 (13 points)
(a) (2 points) Plot the gradient curve of the following 1-D signal.
(b) (2 points) Explain the meanings of gradient obtained from a 2D image in terms of
magnitude and orientation.
(c) (2 points) Convolve the following 4x4 array with the Sobel kernel that detects
horizontal edges. (Use even boundary extension)
33 62 55 73
21 77 65 150
10 29 212 198
17 34 83 142
(d) (3 points) Compare the first order and second order edge detection methods.
(e) (2 points) For median filter, what’s the difference between large kernel size and
small one? Which one outperforms the other?
(f) (2 points) Given an image with impulse noise, Alice applies MINMAX after
MAXMIN while Bob adopts MAXMIN after MINMAX. Would they get the same
results? Why or why not?
Problem 5 (20 points)
(a) (10 points) Please apply three morphological operation
skeletonizing, to the following images
state and plot the results
(b) (5 points) Apply mask A to the
show the result after one iteration.
(a)
(c) (5 points) Suppose B is a binary image and J, K
as follows. Please explain
where 7 is the erosion operator and
lease apply three morphological operations, shrinking, thinning, and
, to the following images (Fig. 5-1) until reaching the convergent
and plot the results in the provided answer sheet.
Fig. 5-1
Apply mask A to the following image to implement dilation filter and
show the result after one iteration.
(a) Input binary image (b) Mask A
Fig. 5-2
B is a binary image and J, K are two different kernels specified
Please explain the purpose of this operation: �B 7is the erosion operator and B9 is the complement of B.
J
K
9
, shrinking, thinning, and
) until reaching the convergent
image to implement dilation filter and
Mask A
nt kernels specified
7 J�;�B9 < K�
is the complement of B.
12
Problem 6 (14 points)
(a) (4 points) Given the following data points, please perform k-means algorithm to
classify these data points to two clusters with two initial centroids, (-0.5,-0.5) and
(0,2). To simplify the computation, please use 1-norm (>x>5 � ∑ |x�|��A5 ) instead
of usually use 2-norm to compute distance between points.
A B C D E F G H I J
(0,0) (0,1) (1,0) (-1,0) (0,-1) (2,1) (2,2) (3,1) (3,2) (5,5)
(b) (4 points) Will the classification result be different if we randomly choose these
two initial centroids?
(c) (3 points) Design and explain a method to choose initial centroids in order to get
more reasonable result efficiently.
(d) (3 points) What will happen if k becomes 3 in this case?
Problem 7 (14 points)
(a) (2 points) The Discrete Cosine Transform (DCT) is a widely used transform. The
definition of DCT is
2),(
CvuF =
where i, u = 0, 1, …, M
are determined by
What is the value of F(0, 0) if the image f(
10 20
90 100
160 150
80 70
10 20
90 100
160 150
80 70
(b) (4 points) F(0,0) is also known a
from Part (a), please explain what the meaning of DC coefficient
called a “DC value”.
(c) (8 points) Fig. 7-1 shows 8x8
transform, please show
the pattern in the position (0,2) below.
The Discrete Cosine Transform (DCT) is a widely used transform. The
2
)12(cos
2
)12(cos
)()( 1
0
1
0
fN
vj
M
ui
MN
vCuC M
i
N
j
ππ ++∑∑
−
=
−
=
, M-1 and j, v = 0, 1, …, N-1, and the constants C(u) and C(v)
==
otherwiseC
,1
0,2
2)( ξξ .
hat is the value of F(0, 0) if the image f(i, j) is given as:
20 30 40 50 60 70 80
100 110 120 130 140 150 160
150 140 130 120 110 100 90
70 60 50 40 30 20 10
20 30 40 50 60 70 80
100 110 120 130 140 150 160
150 140 130 120 110 100 90
70 60 50 40 30 20 10
F(0,0) is also known as a DC coefficient. By the computation experience
(a), please explain what the meaning of DC coefficient
shows 8x8 2-D DCT basis functions. By definition of DCT
transform, please show in a mathematical way that F(0,2) is actually related to
the pattern in the position (0,2) below.
Fig. 7-1: 2-D DCT basis functions
14
The Discrete Cosine Transform (DCT) is a widely used transform. The
),( jif
1, and the constants C(u) and C(v)
By the computation experience
is and why it is
. By definition of DCT
actually related to