You are on page 1of 3

Polytechnic Institute of NYU

EL5123/BE6223 --- DIGITAL IMAGE PROCESSING

Fall 2013
Yao Wang

Midterm Exam (10/28, 10:20-12:50)


Closed book, 1 sheet of notes (double sided) allowed. No calculator needed.
No peeking into neighbors or unauthorized notes. Cheating will result in getting an F on the course.
Please put your cell phone and any other electronic devices into your backpack and leave your backpack in the front of classroom.
Write your answers on this problem sheet for problems where space is provided. Otherwise write you answer in the blue book.
Submit both the blue book and this problem set.

Your name and ID: ______________________________________

1. (10pt) Briefly answer the following questions: a) how does the human visual system perceive color? b) What does
the color mixing theory tells us? c) How do we use this theory to capture color images? d) What are the three
attributes of color? e) Why do we want to change an image in RGB coordinate to YCbCr coordinate sometimes?
Give two reasons.
2. (15 pt) Suppose the intensity value of a gray scale image has a probability distribution illustrated in the figure below.
For simplicity, we assume that the intensity is continuously distributed between 0 and 256. We would like to
represent the intensity at each pixel with 3 levels. (a) (5pt) If we use a uniform quantizer, what should be the decision
and reconstruction values? What is the mean square error of the quantized image using this quantizer? (b) (10pt)
Repeat the above for a non-uniform quantizer that minimizes the mean square reconstruction error. Hint: you should
try to make use of symmetry as much as possible to simplify your solution.

pF(f)
1/128

128

256 f

3. (15 pt) For the image shown in Fig. A, find a transformation function (i.e. a look-up-table) that will change its
histogram to match the one shown in Table A. Draw the transformed image in Fig. B. Assume that the processed
images can only take integer values between 0 and 3 (including 0 and 3), and give the histograms of the original and
processed images in Table B and Table C, respectively.
0

Fig. A
Table A: Desired histogram
Gray level f
0
1
Histogram h(f) 2/16
5/16

Fig. B
2
7/16

Table B: Original image histogram


Gray level f
0
1
2
Histogram h(f)

3
2/16
3

Table C: Transformed image histogram


Gray level f
0
1
2
3
Histogram h(f)
4. (15pt) For filter H1: a) Is the filter a separable filter? If yes, present the horizontal and vertical filters. Explain the
functionality of the filter based on its spatial representation; For the filter H2: b) is the filter a separable filter? If yes,
present the horizontal and vertical filters. Explain the functionality of the filter based on its spatial representation; c)
Derive its frequency response. Use the separable property of the filter if possible. d) Illustrate the frequency response
using a surface plot (indicate key points in your plot, e.g. the frequency where the response is 0 and
maximum/minimum. d) Explain the functionality of the filter, based on its frequency representation. Assume the
origin of each filter is at the center, and above the center is positive in vertical axis, and to the right of the center is
positive in horizontal axis. In frequency domain, use u to represent the vertical frequency and v the horizontal
frequency.

" 1 2 1 %
" 1 2 1 %
$
'
'
1
1$
H1 = $ 2 12 2 ', H 2 = $ 2 4 2 '
12 $
16 $
'
'
# 1 2 1 &
# 1 2 1 &

5. (15 pt) Consider linear convolution of an image of size MxN with a filter of size KxL. We can either do the
convolution directly, or using 2D fast DFT (FFT) with size SxT. Express your answers to following questions in
terms of M,N,K, and L. (a) What is the size of the convolved image? (b) What is the number of multiplications
needed if we do convolution directly? You should not assume the filter satisfy any symmetry property. (c) What
would be the number of multiplications if the filter is separable and you use separable filtering? (d) If you use 2D
DFT to implement the linear convolution, how should you choose S and T for your result to be correct? (e) Assume
that 1D N-point FFT takes N log(N) multiplications. What is the total number of multiplications needed to compute a
2D DFT of size SxT using 1D FFT algorithm? (f) What is the total number of multiplications required to implement
the filtering using the FFT? Express your answer in terms of S and T. You should assume that the 2D DFT for the
filter has already been computed in advance.
6. (10 pt) Suppose the image f(m,n) has a size 256x256. We take 256x256 point 2D DFT of the image to yield F(k,l).
We filter the image in the DFT domain using G(k,l)=F(k,l) H(k,l). We then take inverse 256x256 point DFT to
obtain the filtered image g(m,n). Assume the filter H(k,l) is as specified blow. (a) (2pt) How do you think the image
g(m,n) would look? (b) (4pt) Determine the inverse transform of H(k,l), and denote it by h(m,n); (c) (2pt) How is
g(m,n) related to f(m,n) and h(m,n)? (d) (2pt) Suppose z(m,n) is the result of linear filtering of f(m,n) by h(m,n). Is
there any part of g(m,n) that is equal to z(m,n)?

H (k, l) = P(k)P(l), with


P(k) = 1, for k = 0,1, 255;
P(k) = 0 for k = 2, 3,..., 254.

7. (20pt) Write a MATLAB code to implement the histogram equalization on the luminance component of a color
image. Your program should i) Read in a color image from a file with a given filename (inimg.jpg), and display
the image; ii) convert the image from RGB representation to YCbCr; iii) Calculate the histogram of the Y image, and
display the histogram as a bar plot; iv) Compute the transformation function that will equalize the histogram; v)
Apply the transformation function on the Y image; vi) Calculate the histogram of the equalized Y image and display
it as a bar plot; vii) Using the enhanced Y image and the original Cb and Cr image, convert them to RGB image, and
display the new color image; vii) save the enhanced image into a file with a given filename (outimg.jpg);
You could use the following MATLAB functions: RGB2YCBCR( ); YCBCR2RGB(); imread( ); imwrite();
imshow(); You should write you own functions for determine histogram, determine the transformation function, and
applying the transformation function.

You might also like