Image Processing: Final Exam November 10, 2017-8:30 10:30 Student name: Student number: Put your name and student number on all of the papers you hand in (if you take out the staple). There are always potentially multiple correct answers in the multiple-choice questions. Missing one correct answer or providing an incorrect answer will cost you half of the points. For the images shown, brighter gray values correspond to higher pixel values. Fill in the answers in the boxes provided. Dutch or English are both fine. You are not allowed to use any other materials but a pen. So no reader, slides, phone, etc. Hand over the exam with your answers when you leave. Show your student ID card. You are free to leave at any moment after 9:00. The total number of points is 100. Good luck! Question 1: (15 points) Consider the image of 5 5 pixels below. The grayscale values are: 4 1 4 2 2 3 4 0 3 3 3 4 3 2 4 1 3 3 3 3 1 1 3 4 3 (i) The minimum bit-depth needed to describe this image is 3. (ii) The histogram h(a), the cumulative histogram H(a), the probability distribution p(a) and the cumulative probability distribution P (a) are: a h(a) H(a) p(a) P (a) 0 1 1 0.04 0.04 1 4 5 0.16 0.2 2 3 8 0.12 0.32 3 11 19 0.44 0.76 4 6 25 0.24 1 1
(iii) Equalize the histogram to obtain the new histogram h eq (a). a h eq (a) 0 5 1 3 2 0 3 11 4 6 (iv) In order to match the histogram h(a) to a given probability distribution p R (a), sometimes we cannot use the usual formula a = f s (a) = P 1 (P (a)). When and why? R (a) when p(a min ) p(a max ), because the inversion would not be upper-bounded (b) when, for some a, p(a) = 0, because it would be not invertible (c) when h(a) < 1, because it would cause extremely high amplification of small intensity values (d) when, for some a, p(a) = p(a + 1), because it wouldn t be well-defined for all the values Answer: b. (v) Let us try to do the opposite: given the histogram h(a) and a grid of size M N, how do you get to the original image? (a) It is impossible, multiple images can have the same histogram (b) For every a, we place on the grid h(a) pixels of intensity a, in increasing order (c) For every a, we place on the grid h(a) pixels of intensity a, in decrescent order (d) After normalizing the histogram, for every a, we place on the grid h(a) pixels of intensity a, in crescent order Answer: a. 2
Figure 1: Lena image (left) with processed images (A-D) and possible mapping functions a a (horizontal axis: a, vertical axis: a ) 1-8 (right). Question 2: (4 points) Figure 1 (left) has been processed with four different mapping functions (right). Indicate, for each figure A-D, which function (1-8) has been applied. A B C D 4 5 7 1 3
Question 3: (3 points) Two images of identical sizes have identical histograms. Which of the following statements are correct? (a) The two images are identical (b) The correlation coefficient between the two images lies within the interval [ 1, 1] (c) There is a high degree of similarity between the two images (d) One image is a mirror image of the other (e) The range of pixel values between the two images is identical Answer: b, e. Question 4: (8 points) (i) What is the main drawback in terms of output when using Kirch operators to determine the orientation of edges? Answer: You can only detect orientations a multitude of 45 degrees. (ii) Give a kernel that, after convolution, does not change pixel values in even areas in an image, but exaggerates noise. -1-1 -1-1 9-1 -1-1 -1 Question 5: (13 points) (i) Calculate the opening of the grayscale image below, using a 3 3 square structuring element. You can ignore the values outside the image (i.e., assume they are or, depending on your operation). Use the Intermediary array if you need, and fill in the final answer in the Answer array. 4 4 4 4 5 4 2 4 4 5 4 5 1 2 3 3 2 3 4 5 5 3 3 2 2 3 2 3 3 5 5 3 3 2 1 2 2 2 2 1 5 1 2 2 2 2 2 2 2 2 3 4 3 2 3 3 2 3 1 1 4 3 3 3 4 4 1 3 0 1 5 4 3 4 4 4 1 1 1 1 Intermediary: 4 1 1 1 2 2 2 2 3 4 3 1 1 1 2 2 2 2 3 3 3 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 1 1 0 0 0 3 3 2 2 2 1 1 0 0 0 3 3 3 3 3 1 1 0 0 0 Answer: 4 4 1 2 2 2 2 3 4 4 4 4 1 2 2 2 2 3 4 4 3 3 1 2 2 2 2 3 3 3 3 3 1 1 1 2 2 2 2 1 1 1 2 2 2 2 2 2 2 1 3 3 3 2 2 2 2 2 1 1 3 3 3 3 3 3 1 1 0 0 3 3 3 3 3 3 1 1 0 0 4
(ii) Provide the run length encoding of this image, after applying a threshold such that all values of 3 and higher are foreground, and values below 3 are background. < 0, 0, 2 >, < 0, 7, 3 >, < 1, 0, 2 >, < 1, 7, 3 >, < 2, 0, 2 >, < 2, 7, 3 >, < 3, 0, 2 >, < 5, 0, 3 >, < 6, 0, 6 >, < 7, 0, 6 > Question 6: (4 points) A white top hat filter performs an opening of an image and subtracts this from the original image. When applying this filter to a grayscale image, what can you say about the results? (a) Isolated noise (spurious pixels) are mostly removed. (b) It can find edges of shapes if these are not thinner than the size of the structuring element. (c) When applying a threshold, its performance is similar to local adaptive thresholding. (d) The image will generally be darker. (e) The result is the same as performing a closing of an image, and subtracting the original image. Answer: c,d Question 7: (16 points) Consider the image in Question 1 again, which can be considered grayscale with the bit depth you specified in Question 1(i). You have the following 4 4 template to match with it. 2 5 2 4 3 2 6 3 3 2 3 4 5 3 3 3 (i) Match this template to the picture at top-left, top-right, bottom-left and bottom-right, and fill out the table below (standard notations from the book: d A is the sum of absolute differences, d M is the maximum difference, d 2 E is the sum of square distances, C N is the normalized cross-correlation, C L is the correlation coefficient). Fill in the empty cells in the following table. position d A d M d 2 E C N C L top-left 26 6 2 23 top-right 15 3 3 3 14641 0.74 26989 1 4805 5516 0.93 37 0.46 6517 bottom-left 22 4 4 3 138 25019 0.87 5 2457 0.1 bottom-right 23 5 69 139 29550 0.81 107 24353 0.68 5
(ii) Which part of the picture best matches to the template? Answer: Answer: top-left. (iii) How would you characterize the best-matched part of the image with respect to the template? Answer: it is inverted with respect to the template, and then one shade darker. (iv) Of all the measures in the above table, which one is the best? Answer: correlation coefficient C L. Question 8: (15 points) (i) Calculate the Chamfer transform for the following binary image using Manhattan distance 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0 0 0 0 0 0 1 0 2 1 0 1 2 3 3 4 1 0 1 0 1 2 2 3 0 0 0 0 0 1 1 2 1 1 0 1 1 1 0 1 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 0 2 1 2 1 2 1 0 1 6
(ii) Chamfer-match the following template to the image in (i), using positions top-left, top-right, bottom-left and bottom-right. 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 1 1 0 0 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 1 0 1 0 position Q-value top-left 1/13 top-right 11/13 bottom-left 9/13 bottom-right 1 (iii) Which position provides the best match? Answer: top-left. Question 9: (12 points) You have the following image processing functions: threshold, linear filter, median filter, max filter, min filter, hit-or-miss transformation, Canny edge detection, erosion, dilation, geodesic erosion, geodesic dilation, reconstruction from erosion, color counting, region labeling and Hough transform. You may assume they all work as expected, deal with image borders and ranges appropriately and can handle arbitrary kernel sizes (if applicable). For kernels and structuring elements, you may assume that you can set these to your needs. Other parameters can also be specified. (i) What is the optimal pipeline (sequence of processing steps) to efficiently obtain the parameters of straight lines of arbitrary angle in a grayscale image? You can only use the functions mentioned above. Answer: Canny edge detection (or linear filter threshold) Hough transform closing region labeling (i) When only vertical lines are considered, what is the optimal pipeline (sequence of processing steps) to efficiently label (i.e. make foreground) the pixels of these lines in a grayscale image? You can only use the functions mentioned above. Answer: hit-and-miss transformation 7
Question 10: (6 points) We want to automatically find a threshold to separate the foreground pixels from the background pixels in a grayscale image (maximum range is 0-255). Assume our foreground object has pixel intensity values in the range 100-200. For the background, there are three different options. Indicate with a cross ( X ) which of the techniques are capable of giving a perfect segmentation and a circle ( O ) which algorithms will give a reasonably reasonable result in this particular situation. (I) White: the background is completely white (value 255). (II) Gradient: the background has a gradient (from left to right) going from value 0 to value 255. (III) Checkerboard: the background has a checkerboard pattern with squares of 40 40 and values 0 and 255. Background Otsu s method Minimum error thresholding Bernsen s method White X X X Gradient O Checkerboard X (with 3 Gaussians) Question 11: (4 points) What is true about HSV? (a) It contains relatively many dark colors compared to RGB. (b) HSV colors can be linearly converted to RGB. (c) Its gamut is larger than that of CIEXYZ. (d) It is perceptually motivated. (e) In its common implementation, similar colors are always close (f) It is an additive color space. Answer: a, b, f That s it! 8