Download presentation

Presentation is loading. Please wait.

Published byAlivia Verge Modified about 1 year ago

1
Instructor: Mircea Nicolescu Lecture 6 CS 485 / 685 Computer Vision

2
Edge Detection Using Derivatives Points that lie on an edge can be found by: (1) Detecting the local maxima or minima of the first derivative. (2) Detecting the zero-crossings of the second derivative. 2 nd derivative 1 st derivative 2

3
Image Derivatives How can we differentiate a digital image? −Option 1: reconstruct a continuous image, f(x,y), then compute the derivative. −Option 2: take discrete derivative (i.e., finite differences) Consider this case first! 3

4
Edge Detection Using First Derivative ramp edge roof edge (upward) step edge (downward) step edge (centered at x) 1D functions (not centered at x) 4

5
Edge Detection Using Second Derivative Approximate finding maxima/minima of first derivative by finding places where: Can’t always find discrete pixels where the second derivative is zero – look for zero-crossing instead. 5

6
Replace x+1 with x (centered at x): 1D functions: (centered at x+1) Edge Detection Using Second Derivative 6

7
7

8
(upward) step edge (downward) step edge ramp edge roof edge Edge Detection Using Second Derivative 8

9
Effect of Smoothing on Derivatives Where is the edge? 9

10
Effect of Smoothing on Derivatives 10

11
Combine Smoothing with Differentiation (saves one operation) 11

12
Mathematical interpretation: Numerical differentiation is an ill-posed problem - solution does not exist or it is not unique or it does not depend continuously on initial data Ill-posed problems can be solved using “regularization” - impose additional constraints Smoothing performs image interpolation Combine Smoothing with Differentiation 12

13
13 Edge Detection Using the Gradient The first derivative of an image can be computed using the gradient: To save computations, the magnitude of gradient could be approximated by: 2D functions

14
14 Edge Detection Using the Gradient Properties of the gradient: −The magnitude of gradient provides information about the strength of the edge −The direction of gradient is always perpendicular to the direction of the edge Main idea: −Compute derivatives in x and y directions −Find gradient magnitude −Threshold gradient magnitude

15
Approximate gradient using finite differences: Approximate Gradient 15 hxhx

16
Cartesian vs pixel-coordinates: - j corresponds to x direction - i to -y direction Approximate Gradient 16 i j

17
sensitive to vertical edges! sensitive to horizontal edges! Approximate Gradient 17

18
We can implement f/ x and f/ y using the following masks: (x+1/2,y) (x,y+1/2) * * approximation at (x+1/2,y) approximation at (x,y+1/2) Approximate Gradient 18

19
A different approximation of the gradient: f/ x and f/ y can be implemented using the masks: * (x+1/2,y+1/2) approximation at Approximate Gradient Roberts edge detector 19

20
20 The Prewitt edge detector −The partial derivatives can be computed by: Note: M x and M y are approximations at (i, j)) −Consider the arrangement of pixels about the pixel (i, j): −The constant c implies the emphasis given to pixels closer to the center of the mask. −Setting c = 1, we get the Prewitt operator: Approximate Gradient

21
21 The Sobel edge detector Note: M x and M y are approximations at (i, j)) −Setting c = 2, we get the Sobel operator: Approximate Gradient

22
22 Edge Detection Using the Gradient Main steps in edge detection using masks:

23
23 Edge Detection Using the Gradient (an example using the Prewitt edge detector) Note: in this example, the divisions by 2 and 3 in the computation of f x and f y are done for normalization purposes only

24
24 Edge Detection Using the Gradient Another example:

25
25 Edge Detection Using the Gradient Example – cont.:

26
26 Edge Detection Using the Gradient Example – cont.:

27
Isotropic Property of Gradient Magnitude The gradient magnitude detects edges in all directions. 27

28
28 Practical Issues −Differential masks act as high-pass filters – tend to amplify noise. −To reduce the effects of noise – first smooth with a low-pass filter. 1)The noise suppression tradeoff −A larger filter reduces noise, but worsens localization (i.e., it adds uncertainty to the location of the edge) and vice-versa.

29
29 Practical Issues 2)Choice of threshold gradient magnitude low thresholdhigh threshold

30
30 Practical Issues 3)Edge thinning and linking −required to obtain good contours

31
31 Criteria for Optimal Edge Detection −Good detection: the optimal detector must minimize the probability of false positives (detecting spurious edges caused by noise), as well as that of false negatives (missing real edges) −Good localization: the edges detected must be as close as possible to the true edges. −Single response constraint: the detector must return one point only for each true edge point; that is, minimize the number of local maxima around the true edge

32
32 The Canny Edge Detector −This is probably the most widely used edge detector in computer vision. −Canny has shown that the first derivative of the Gaussian closely approximates the operator that optimizes the product of signal-to- noise ratio and localization. −Analysis is based on "step-edges" corrupted by "additive Gaussian noise". The Canny edge detector:

33
33 The Canny Edge Detector

34
34 The Canny Edge Detector The derivative of the Gaussian:

35
35 The Canny Edge Detector Canny – smoothing and derivatives:

36
36 The Canny Edge Detector Canny – gradient magnitude: imagegradient magnitude

37
37 The Canny Edge Detector −To find the edge points, we need to find the local maxima of the gradient magnitude. −Broad ridges must be thinned so that only the magnitudes at the points of greatest local change remain. −All values along the direction of the gradient that are not peak values of a ridge are suppressed. Non-maxima suppression

38
38 The Canny Edge Detector Non-maxima suppression – cont. (i,j) Warning: may require checking interpolated pixels p and r

39
39 The Canny Edge Detector Canny – Non-maxima suppression: gradient magnitudethinned

40
40 The Canny Edge Detector Hysteresis thresholding / Edge linking Standard thresholding: - Can only select “strong” edges - Does not guarantee continuity gradient magnitudelow thresholdhigh threshold

41
The Canny Edge Detector Use two thresholds: For “maybe” edges, use neighboring pixels to decide - low threshold t l - high threshold t h (usually, t h = 2t l ) t l ≤ tltl thth thth Hysteresis thresholding / Edge linking – cont. 41

42
Idea: use a high threshold to start edge curves and a low threshold to continue them. Use edge direction for linking edges The Canny Edge Detector Hysteresis thresholding / Edge linking – cont. 42

43
43 The Canny Edge Detector Hysteresis thresholding / Edge linking – cont. −The algorithm performs edge linking as a by-product of double- thresholding −Note: large gaps are still difficult to bridge (more sophisticated algorithms are required)

44
44 The Canny Edge Detector Canny – Hysteresis thresholding / Edge linking thinned

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google