Examination in Digital Image Processing, TSBB08 Time: 2012-10-20, 14.00-18.00 Location: TER4 Examiner: Maria Magnusson will visit the classroom at 15.00 and 17.00, tel. 177786, 281336, 073 - 804 38 67 Tables, etc: Calculator, OH-film Dictionaries: English to Swedish/German/French/Italian/Spanish/Polish/Latvian... The following tables: 0) “Formula collection for Digital Image Processing” (supplied) 1) “Formler och tabeller” by Söderkvist 2) “Formelsamling i Signalteori” by Henriksson/Lindman 3) “Tables and Formulas for Signal Theory” by Mikael Olofsson 4) “Beta” 5) “Physics Handbook” 6) “Transformteori sammanfattning, formler & lexikon” by Kurt Hansson Grades: 21-30 points : grade 3 31-40 points : grade 4 41-50 points : grade 5 Posting date: The grade list will be posted by 2012-11-05 No. problems: The examination contains 7 problems 1 1 The 2D Fourier transform and sampling (8p) The function f (x, y) has a 2D Fourier transform F (u, v) shown in the figure below. F (u, v) = 1 in the shaded area and zero outside. v F(u,v) 0.6 u −0.6 0.3 0.2 0.6 −0.6 a) The function f (x, y) is sampled by a 2D impulse train to g(x, y) = f (x, y) · δ(x − n/0.6) · δ(y − m/0.6), n m i.e. the sampling distance is Δ = 1/0.6 in both directions. Sketch G(u, v) in the (u, v)-plane and grade the axes. To save your time, you can complete the figure on the last paper in the exam. The paper can be torned out of the exam, signed and submitted as a solution. (2p) b) Did you get aliasing or not in a)? Which sampling distance Δ gives aliasing for F (u, v) and which do not give aliasing? (2p) c) Now consider H(u, v) = R45◦ [F (u, v)], i.e. you get H(u, v) if you rotate F (u, v) 45◦ . Determine the 2D inverse Fourier transform of H(u, v)! (2p) d) Which sampling distance Δ gives aliasing for H(u, v) and which do not give aliasing? (2p) 2 Canny’s Edge detection (10p) a) Describe Cannys edge detection in 5 steps. Use the following words in your description: • gradient angle • non-maxima suppression • thresholding with hysteresis • Gaussian smoothing • morphological thinning • gradient magnitude (2p) 2 b) Calculating the gradient magnitute and gradient angle is part of Canny’s method. Below you can see a part of an image f (x, y). f(x,y) 2 1 0 0 0 3 2 0 0 0 3 2 2 0 0 3 3 2 0 0 3 3 2 1 0 3 3 3 2 1 Use the sobel pair 1 0 sobelx = 2 0 1 0 -1 -2 /8, -1 -1 sobely = 0 1 -2 -1 0 0 /8, 2 1 to calculate the magnitude of the gradient M (x, y) and the gradient angle in the marked pixel. (3p) c) Non-maxima suppression is part of Canny’s method. In the surrounding f (x, y) illustrated below, the gradient direction in the central pixel is given. Also, the corresponding gradient magnitude M (x, y) is given. f(x,y) M(x,y) 40 deg 3 3 3 3 4 5 3 5 5 gradient Will the central pixel in M (x, y) be suppressed or not? Describe carefully how you make the decision! (2p) d) Thresholding with hysteres is part of Canny’s method. Complete the flow chart below and explain how it works. What is the stop critera? (3p) image a image b:= (a>T1) image c:= (a>T2) 3 3 The Fourier transform and its theorem (6p) a) Calculate the Fourier transform of g(x, y) = [δ(x + 1, y) + δ(x − 1, y)] ∗ [Π(x) · Λ(2y)] Use the formula collection! (3p) b) When collecting data from MRI, the two-dimensional Fourier transform being measured. (MRI physicists call it the k-space.) EPI is a fast collecting technique, but it gives a shift of every other line in the Fourier transform that must be compensated for. One possibility would be to perform linear interpolation, but this is not regarded as sufficiently accurate. Instead, DFT and the translation theorem are utilized. For DFT/IDFT, there exists of a slightly modified translation theorem, namely DFT[f (x − a, y − b)] = exp(−j2π(au + bv)/N )F (u, v), IDFT[F (u − a, v − b)] = exp(j2π(ax + by)/N )f (x, y), where N is the image size. a? c? 2D Fourier transform 2D Fourier transform b? See the figure above and try to figure out the content in the boxes marked with a? and c? above, choose among: 1D horizontal DFT 1D horizontal IDFT 1D vertical DFT 1D vertical IDFT 2D DFT 2D IDFT Also give the operation to be performed in the circle marked with b? Suppose that each row is shifted 0.25 pixels. (3p) 4 4 Thresholding with the midway method (6p) An image with a bright object and a dark background can often be thresholded to a binary image. Such an image has a histogram with two peaks. Suppose that the histogram p(f ) looks as in the figure below. p(f) f 0 T(i) N A rather good threshold can be found with the midway method. The midway method is iterative and calculates mean values. a) Describe the midway method carefully. (3p) b) The midway method includes calculating the mean of the function to the left of the threshold T (i) . Give the equation for this! (1.5p) (i) Hint: It includes a sum Tf =0 . c) A good initial threshold T (0) can be found by calculating another mean. Which? Give an equation for it also! (1.5p) 5 Color (4p) You are going to perform additive color mixing by mixing the red, green and blue intensities on a LCD screen. You can choose among using full intensity, half intensity and no intensity, i.e.: 2 full red, 2 half red, 2 no red, 2 full green, 2 half green, 2 no green, 2 full blue, 2 half blue, 2 no blue a) Which combination do you use to make • white • gray • yellow almost as in the rainbow • light “baby” pink? (2p) b) What about the saturation of the four colors • white • gray • yellow almost as in the rainbow • light “baby” pink? Choose among 2 full saturation, 2 medium saturation and 2 no saturation! (2p) 5 6 Morphological algorithms (8p) Below is one image of a seed and another image of its skeleton. a(x,y) =0 =1 s(x,y) =0 =1 a) Make a distance map of the seed a(x, y) in d(8) -metric! To save your time, you can complete the figure on the last paper in the exam. The paper can be torned out of the exam, signed and submitted as a solution. (2p) b) Call the skeleton image s(x, y). Call the distance map a(x, y). Calculate the mean thickness of the seed by using s(x, y) · a(x, y) x y − 0.5 · 2. t= x y s(x, y) Why is there a subtraction with 0.5 in the equation? Why is there a multiplication with 2 in the equation? (2p) c) Show how to perform thinning to a skeleton in eight phases of the seed! The first pass can be written ((...((A ⊗ B 1 ) ⊗ B 2 )...) ⊗ B 8 ) where A ⊗ B = A − A(∗)B where A(∗)B denotes that the element B is found in A. The structuring element for for phase 1 is: 0 0 0 - 1 1 1 1 6 and the structuring element for for phase 2 is: - 0 0 1 1 0 1 1 First, describe how the structuring elements for phase 3, 4, 5, 6, 7 and 8 look like and then perform thinning. Label the pixels depending on in which phase (and pass) they match. To save your time, you can complete the figure on the last paper in the exam. The paper can be torned out of the exam, signed and submitted as a solution. (4p) (Note that your skeleton will be different from the skeleton s(x, y) above. However, with some postprocessing it will be possible to receive s(x, y) from your skeleton.) 7 Images (8p) Below, an image f (x, y) is shown. f(x,y) 1 0.5 0 This image is convolved with different convolution kernels, A − H, see below. A= 1 0 -1 /2, B = 1 1 1 0 E = 1 /5, F = 1 1 0 1 1 -4 1 1 1 1 0 0 1 /8, G = 0 0 0 0 1 /5, C = 0 0 0 -1 0 0 1 0 , H= 2 0 1 0 1 0 0 -1 0 /2, D = 0 /2 0 1 2 4 2 1 1 2 /16, I = 1 1 1 1 -4 1 The result becomes 8 different images. Pair image1-image8 below with the correct convolution kernel A − I (one should be excluded)! (8p) 7 1 1 /8 1 image 1 image 2 0.5 0.5 0 0 −0.5 −0.5 image 3 image 4 1 1 0.5 0.5 0 0 image 5 image 6 1 0.5 0.5 0 0 −0.5 image 7 image 8 1 0 0.5 −0.5 0 −1 8 AID kod: 1 a) To complete and submit as solution v G(u,v) 0.6 u −0.6 0.3 0.6 0.2 −0.6 TSBB08 9 TEN1, 2012-10-20 AID kod: 6 a) To complete and submit as solution 6 c) To complete and submit as solution TSBB08 10 TEN1, 2012-10-20