Image Processing Practical Three - Edge Detection

10%, To be set ~ 24/11/03, to be completed by 11/12/03 .

1. Objectives

The aim of the third practical is to enhance your understanding of the lectures on filtering and edge detection through the development of code for an edge detector based on Gaussian (separable) convolution, non-maximal suppression and hysteresis, comparison of the Canny output with a simple Sobel operator, and a quantitative evaluation of the performance of the edge detectors.

Your demonstrator for this practical is Song Hu.

2. Procedure

Carry out each of the steps listed below and write a brief report containing:

Include any code you write yourself (suitably commented) in an appendix together with any shell-scripts.

3. Exercises

3.1 Image Acquisition

Copy one of the monochrome images of the circular cardboard discs, and one of the images of the object constructed out of the Duplo bricks, supplied by the demonstrator. These images have been taken for you to ensure that each of the objects fills most of the field of view of the camera and that the images are neither under nor over-exposed.

3.2 Edge detection comparison

By using the images that you copied, visually compare the operation of the supplied Canny detector (eg from Matlab) against a Sobel edge detector constructed by thresholding the output of the Sobel filter mask. Choose suitable values for the threshold of the Sobel edge detector and of the parameters of the Canny detector which give pleasing results on each of your images (they need not be the same for each image), and record them.

Note that in the case of the images taken from the Duplo bricks object we shall be interested only in the boundary around the edges of the object (the "crease" or "occluding" boundaries) and those between differently coloured bricks. Small features such as the lugs on the bricks are not of interest in this exercise.

3.3 Edge detector internals

Write code for a Canny edge detector (in Matlab) as three separate processes operating in sequence for: (a) convolution by a derivative of a Gausssian, (b) non-maximal suppression, (c) hysteresis. In the implementation of the Gaussian convolution you should use the fact that the Gaussian kernel is separable and treat the standard deviation, sigma, of the Gaussian, or the width of the mask used to implement it, as an adjustable parameter to be defined. Comment on what other parameters have to be defined in each of stages (i), (ii) and (iii) above.

Visually inspect what happens at each of the stages (i) to (iii) above and choose suitable values for the mask width (or sigma) and the other parameters which give pleasing results for your version of the Canny edge detector on each of your images (again, they need not be the same for each image). Compare the performance of your own version of the Canny edge detector so constructed with the one supplied.

3.4 Edge detector quality assessment

Using a manual digitisation procedure (see eg. the companion web-page or ask the demonstrator for details on how to do this), manually digitise the key edges you can see in the images (ie, ignore the lugs and other small features in the image of the Duplo bricks object) and construct a binary image mask, G, that is "true" (equal to one) at every pixel where you think there is an edge feature and "false" (equal to zero) otherwise. Write programs to construct similar binary image masks, D, for the edges detected by the Sobel operator, your version of the Canny edge detector and that supplied.

Use these masks as a function of the decision threshold to assess the performance of each of the edge detectors by constructing a receiver operating characteristic curve (ROC) as follows. First compute:

Calculate N(E) + N(B) = N, the total number of pixels that could be marked as edgels or not, and comment of whether this is equal to the number of pixels in your original images. Comment also on the number of edge pixels N(E) that you computed and how, if you consider it necessary, N(E) should be adjusted [Note: you are not asked to make the adjustment.]. Hence, compute the probabilities of: Repeat the above for different values of the decision threshold, plot the probability of detection as a function of this threshold and construct an ROC curve by plotting P(TP) against P(FP). For the Canny edge detectors, you will need to decide whether to treat the upper or lower thresholds as the "decision threshold". Pick one and keep the other fixed at an appropriate high or low value or as a multiple/fraction of the other. Explain which method you use and the reasons for your choice of decision threshold.

Comment on the form of the curves you have plotted and, if you can, use the ROC curves to determine:

Comment on the results you obtained: (a) by referring back to the thresholds you chose in sections 3.2 and 3.3 above and what you know about the principles of threshold selection, (b) by inspection of probability of edge detection, P(D) and of the form of the ROC curves, (c) by reference to what you have been told about the merit of the Canny edge detector, and (d) any difficulties you think there may be in using the ROC paradigm to evaluate these edge detectors.

4. Reporting

Produce a summary report on paper (in the format indicated in section 2 above and for practical one) which includes a critical appraisal of the application of Canny on your test data.

Bernard Buxton
November 2003