Docsity

Practice Test with Solution for Image Processing | CS 6640, Exams of Computer Science

Toggle sidebar
bg1
CS 6640: IMAGE PROCESSING
Spring 2009
Practice Test #1 Solutions
1. (25 pts.)
Give the Fourier transform of the following functions (you may derive them any way you
wish — show relevant work). Hint: They are quick to derive if you think about each one.
(a)
f(t) =
−1−1≤t≤0
1 0 ≤t≤1
0 otherwise
Because we know the rect(x)function and its Fourier transform:
rect(x) = (1,|x|<1
2
0,|x|>1
2
IF{rect(x)}= sinc(πs) = sin(πs)
πs
We can derive the Fourier transform of f(x)from rect(x)by the shift theorem, and the
linearity of Fourier transform. We can rewrite f(x)as
f(x) = rect(x−1/2) −rect(x+ 1/2) (1)
F(s) = e−j2πs 1
2sinc(πs)−e−j2πs −1
2sinc(πs)
= sinc(πs)(e−j2πs 1
2−ej2πs 1
2)
=2 sin2(πs)
jπs (2)
(b)
f(t) =
−t−2−2≤t≤ −1
t−1≤t≤1
−t+ 2 1 ≤t≤2
0 otherwise
Similarly, we can derive the Fourier transform of this function from the Triangle func-
tion, whose Fourier transform we already know.
tri(x) = (1− |x|,|x| ≤ 1
0,|x|>1
IF{tri(s)}= sinc2(πs) = sin2(πs)
(πs)2
1
pf3
pf4
pf5

Partial preview of the text

Download Practice Test with Solution for Image Processing | CS 6640 and more Exams Computer Science in PDF only on Docsity!

CS 6640: IMAGE PROCESSING

Spring 2009 Practice Test #1 Solutions

  1. (25 pts.)

Give the Fourier transform of the following functions (you may derive them any way you wish — show relevant work). Hint: They are quick to derive if you think about each one.

(a)

f (t) =

  

− 1 − 1 ≤ t ≤ 0 1 0 ≤ t ≤ 1 0 otherwise

Because we know the rect(x) function and its Fourier transform:

rect(x) =

{ 1 , |x| < (^12) 0 , |x| > (^12)

IF{rect(x)} = sinc(πs) =

sin(πs) πs We can derive the Fourier transform of f (x) from rect(x) by the shift theorem, and the linearity of Fourier transform. We can rewrite f (x) as

f (x) = rect(x − 1 /2) − rect(x + 1/2) (1) F (s) = e−j^2 πs^

(^12) sinc(πs) − e−j^2 πs^

− 1 (^2) sinc(πs) = sinc(πs)(e−j^2 πs^

(^12) − ej^2 πs^

(^12) )

=

2 sin^2 (πs) jπs

(b)

f (t) =

    

−t − 2 − 2 ≤ t ≤ − 1 t − 1 ≤ t ≤ 1 −t + 2 1 ≤ t ≤ 2 0 otherwise Similarly, we can derive the Fourier transform of this function from the Triangle func- tion, whose Fourier transform we already know.

tri(x) =

{ 1 − |x|, |x| ≤ 1 0 , |x| > 1

IF{tri(s)} = sinc^2 (πs) =

sin^2 (πs) (πs)^2

Thus,

f (x) = tri(x − 1) − tri(x + 1) (3) F (s) = sinc^2 (πs)(e−j^2 πs^ − ej^2 πs)

=

2 sin^2 (πs) sin(2πs) j(πs)^2

  1. (20 pts.) Consider an input image I with a intensity histogram A(u), where 0 ≤ u ≤ 1. Suppose we would like to modify the grey levels of I so that the resulting image has the histogram C(u) =

{ 2 − 4 u 0 ≤ u ≤ (^12) −2 + 4u 12 ≤ u ≤ 1

(a) Give a complete description (with equations) of how you would construct the new image. Let the cumulative histogram of the input be HA(u) and of the final image be HC (u). The intensities range from zero to one and normalize the size (area under histogram) to be one. The output intensity, z, is given by the transformation

z = H C− 1 (HA(u)).

(b) What is the cumulative histogram associated with C(u)? Given an equation and sketch it. You simply integrate C(u) and make sure that you put in the correct constant for the second part. I.e. we know that it must start at zero and end at one.

HC (u) =

{ 2 u − 2 u^2 0 ≤ u ≤ (^12) 1 − 2 u + 2u^2 12 ≤ u ≤ 1

The inverse is given by solving the quadratic for each part.

H C− 1 (z) =

  

2 − 2 √ 1 − 2 z 4 0 ≤^ z^ ≤^

1 2 2+

1 −2(1−z) 4

1 2 ≤^ z^ ≤^1

(c) What qualitative affect would you expect this transformation to have on most images?

It will probably increase the overall contrast. I.e. push grey values to lighter or darker.

  1. (15 pts.) Compute the discrete Fourier transform (DFT) of the following 2D function. Show all work, equations, and coefficients. Hint: you can compute the coefficients for a four-point DFT, and use them over and over again. Also answer the question—how could you have known what the solution would be without computing it.

(b) What is an improved algorithm that produces the same result and what is the run time of this improved algorithm?

Sliding window agorithm is better: when sliding the window, we merely remove the left column and add the right column, and thus do not have to recalculate the histogram for the whole new window. The run time is

M N 2

(c) What is the approximation that most people do for an even faster speed up? Describe the run time of the approximat algorithm in terms of whatever relevant parameters you can think of. Adaptive histogram equalization, divide the image into sections and calculate the new value via bilinear interpolation. Run time is

N 2

  1. (25 pts.) Suppose you are given a set of N correspondences

{( C¯ 1 , C¯ 1 ′), ( C¯ 2 , C¯ 2 ′),... , ( C¯N , C¯ N′ )}

and you are told that they represent an image warping which is adequately modeled by a second-order polynomial in x and y, which are the image coordinates. Hint: a second-order polynomial in x and y is the sum of monomials in x and y of order two or less.

(a) How would you go about finding that second-order polynomial?

The polynomials are:

x′^ = ax^2 + by^2 + cxy + dx + ey + f y′^ = a′x^2 + b′y^2 + c′xy + d′x + e′y + f ′

We can establish a linear system and solve it with 12 unknowns. The linear system can be solved numerically using the SVD algorithm, or directly solved by matrix inversion and multiplication. (b) Give all of the relevant equations (e.g. expression for linear system) that you would use to find that polynomial. Establish the coefficient matrix similar to what we did in image mosaicing. The column vector of unknowns are the coefficients of the polynomials. The matrix is constructed

from the input data (correspondences) as is the right most vector.

    

x^20 y 02 x 0 y 0 x 0 y 0 1 0 0 0 0 0 0 0 0 0 0 0 0 x^20 y^20 x 0 y 0 x 0 y 0 1 x^21 y 12 x 1 y 1 x 1 y 1 1 0 0 0 0 0 0 0 0 0 0 0 0 x^21 y^21 x 1 y 1 x 1 y 1 1 ...

    

            

a b c d e f

a′ b′ c′ d′ e′ f ′

            

    

x′ 0 y′ 0 x′ 1 y′ 1 ...

    

(c) How many control points would you need to solve this problem?

At least 6.