Presentation is loading. Please wait.

Presentation is loading. Please wait.

October 1, 2013Computer Vision Lecture 9: From Edges to Contours 1 Canny Edge Detector However, usually there will still be noise in the array E[i, j],

Similar presentations


Presentation on theme: "October 1, 2013Computer Vision Lecture 9: From Edges to Contours 1 Canny Edge Detector However, usually there will still be noise in the array E[i, j],"— Presentation transcript:

1 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 1 Canny Edge Detector However, usually there will still be noise in the array E[i, j], i.e., non-zero values that do not correspond to any edge in the original image. In most cases, these values will be smaller than those indicating actual edges. We can then simply use a threshold T to eliminate the noise. All values of E[i, j] < T are set to 0, and the other values remain unchanged or are set to 1 (whatever you prefer). Then the Canny edge detector operation is complete.

2 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 2 Canny Edge Detector - Example Let us look at the following (already smoothed) sample image and perform Canny edge detection on it: grayscale image 385456978579 69618490105100 82100101121165176 7187119182202211 10113118020021520978120170183213220 intensity values of same image

3 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 3 Canny Edge Detector - Example Applying the vertical and horizontal gradient filters gives us the following results: Q[i, j] 000000 0-4-12.5-23.5-1.55.5 0-5-12-13-29.5-3 0-17-16.5-41.5-32-10 0-23-40.5-41.5-17.5-1.50-36-49.5-16.5-22.5-0.5 P[i, j] 000000 0-19-17.5-10.5-6.5-20.5 0-26-28-24-45.5-68 012-2.5-39.5-49-36 0-37-52.5-39.5-15.55.50-1710.513.59.5-4.5

4 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 4 Canny Edge Detector - Example Based on P[i, j] and Q[i, j], we can now compute the magnitude and orientation of the gradient: M[i, j] 000000 019.421.525.76.721.2 026.530.527.354.268.1 020.816.757.358.537.4 043.666.357.323.45.7039.850.621.324.44.5  [i, j] 0000 0000 0000 0000 0000 0000 0000 192  216  246  193  165  0000 191  203  208  213  183  0000 305  261  226  213  196  0000 212  218  226  228  345  0000 295  282  309  293  186 

5 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 5 Canny Edge Detector - Example This allows us to compute the sector  [i, j] for each angle  [i, j]:  [i, j] 000000 001100 001110 032110 011110030330 Remember the directions: 103 2[i,j]2 301

6 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 6 Canny Edge Detector - Example The last steps are nonmaxima suppression and thresholding (here we use T = 30): E[i, j] 000000 000000 026.50054.268.1 00057.358.50 0066.357.3000050.6024.40 final result 000000 000000 000011 000110 001100001000

7 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 7 Canny Edge Detector - Example Finally we visualize the detected edge pixels (0 = white, 1 = black) and indicate the precise edge locations (the pixels’ lower right corners) in the original image: edge locations in original image edge pixels

8 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 8 Evaluating Edge Detector Performance How can we decide which type of edge detector we should use in our application? For this purpose, we need to find a method for evaluating the performance of these detectors. First of all, we need to create one of more test images for which we know the actual locations and orientations of edges. A straightforward idea is to just draw an image showing geometric objects. One possible measure for edge detector performance is called the figure of merit.

9 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 9 Evaluating Edge Detector Performance The figure of merit FM is computed as follows: with number of detected edges I A, number of ideal edges I I, distance between the actual and ideal edges (as matched by an appropriate algorithm) d, and constant for penalizing displaced edges .

10 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 10 Evaluating Edge Detector Performance The maximum value of FM is 1, which indicates perfect performance. The closer FM is to 0, the poorer the performance. Of course even a poor edge detector can perform very well in artificial images that show, for example, only perfect rectangles. In order to perform a more meaningful analysis, we should add noise to our test images and see how well our edge detector can handle it. One possibility is to simulate varying degrees of Gaussian noise in our test images.

11 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 11 Simulating Gaussian Noise In order to simulate Gaussian noise, change the intensity of each pixel according to a Gaussian random distribution: probability intensity original intensity i of pixel Probability for new intensity i’ of pixel standard deviation  of Gaussian determines amount of noise

12 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 12 Simulating Gaussian Noise To simulate a Gaussian random distribution, keep on choosing 2D random points in the marked rectangular area until one of them is under the Gaussian curve. Set i’ to the horizontal coordinate of that point. Set i’ to the horizontal coordinate of that point. probability intensity original intensity i of pixel new intensity i’

13 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 13 Evaluating Edge Detector Performance We can then measure the figure of merit as a function of the Gaussian noise added to the input image:  of Gaussian noise figure of merit 1 0 0 10050 strong (robust) edge detector weak edge detector

14 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 14 From Edges to Contours In order to represent a region boundary, we have to link its local edges. Such a representation is called a contour. Closed contours indicate region boundaries. Open contours are usually parts of region boundaries with gaps due to noise or low contrast. We can represent a contour as an ordered list of edges or as a curve. A curve is a mathematical model of a contour.

15 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 15 Edge Relaxation The edge images generated by edge detection techniques (Sobel, Canny, etc.) are usually noisy. In these images, contours may be visible to the human eye, but they may contain gaps, and there are isolated edges that do not belong to an actual contour. We can use the edge relaxation technique to fill the gaps and remove the isolated edges. It is an iterative method that assigns confidence values to edges and updates these values.

16 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 16 Edge Relaxation Typically, this technique works on crack edges: pixelpixelpixel pixelpixelpixelebg i h a c d f

17 October 1, 2013Computer Vision Lecture 9: From Edges to Contours 17 Edge Relaxation Edges h and i can be used for non-maxima suppression similar to the Canny detector. We will not discuss this here. The edge pattern at an edge e can be described as a pair of integers: the number of connecting edges on the left (edges a, b, c) and the number of connecting edges on the right (d, f, g). Since the left and right sides are exchangeable, we simply write the smaller number first, e.g. 0-1, 1-3, 2-2. These edge patterns determine whether we should increase or decrease the current confidence value for e or leave it unchanged.


Download ppt "October 1, 2013Computer Vision Lecture 9: From Edges to Contours 1 Canny Edge Detector However, usually there will still be noise in the array E[i, j],"

Similar presentations


Ads by Google