Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 8: Edges and Feature Detection

Similar presentations


Presentation on theme: "Lecture 8: Edges and Feature Detection"— Presentation transcript:

1 Lecture 8: Edges and Feature Detection
CS4670/5670: Computer Vision Kavita Bala Lecture 8: Edges and Feature Detection

2 Announcements PA 1 (A) is PA 1 Winter break
A quiz some time after break

3 Characterizing edges An edge is a place of rapid change in the image intensity function intensity function (along horizontal scanline) image first derivative edges correspond to extrema of derivative Source: L. Lazebnik

4 Image derivatives How can we differentiate a digital image F[x,y]?
Take discrete derivative (finite difference) give definition of partial derivative: lim h->0 [f(x+h,y) – f(x,y)]/h How would you implement this as a linear filter? 1 -1 -1 1 : : Source: S. Seitz

5 Effects of noise Where is the edge? Noisy input image Source: S. Seitz
How to fix? Where is the edge? Source: S. Seitz

6 Solution: smooth first
f * h To find edges, look for peaks in Source: S. Seitz

7 Associative property of convolution
Differentiation is a convolution Convolution is associative: This saves us one operation: f Source: S. Seitz

8

9 The 1D Gaussian and its derivatives

10 Derivative of Gaussian filter
x-direction y-direction

11 Tradeoff between smoothing and localization
1 pixel 3 pixels 7 pixels Smoothed derivative removes noise, but blurs edge. Also finds edges at different “scales”. Source: D. Forsyth

12 The Sobel operator Common approximation of derivative of Gaussian
A mask (not a convolution kernel) -1 1 -2 2 1 2 -1 -2 Q: Why might these work better? A: more stable when there is noise The standard defn. of the Sobel operator omits the 1/8 term doesn’t make a difference for edge detection the 1/8 term is needed to get the right gradient magnitude 12

13 Sobel operator: example
Image, x derivative, y derivative, magnitude Source: Wikipedia

14

15 The 1D Gaussian and its derivatives

16 2D edge detection filters
How many 2nd derivative filters are there? There are four 2nd partial derivative filters. In practice, it’s handy to define a single 2nd derivative filter—the Laplacian is the Laplacian operator:

17 2D edge detection filters
Laplacian of Gaussian Gaussian derivative of Gaussian How many 2nd derivative filters are there? There are four 2nd partial derivative filters. In practice, it’s handy to define a single 2nd derivative filter—the Laplacian is the Laplacian operator:

18 Sharpening revisited = = What does blurring take away? – + α
original smoothed (5x5) detail = Let’s add it back: original detail + α sharpened = Source: S. Lazebnik

19 unit impulse (identity)
Sharpen filter blurred image image unit impulse (identity) Gaussian scaled impulse Laplacian of Gaussian f + a(f - f * g) = (1+a)f-af*g = f*((1+a)e-g)

20 Sharpen filter unfiltered filtered

21 Super-resolution

22 Designing an edge detector
Criteria for a good edge detector: Good detection: the optimal detector should find all real edges, ignoring noise or other artifacts Good localization the edges detected must be as close as possible to the true edges the detector must return one point only for each true edge point Cues of edge detection Differences in color, intensity, or texture across the boundary Continuity and closure High-level knowledge Source: L. Fei-Fei

23 Canny edge detector This is probably the most widely used edge detector in computer vision Theoretical model: step-edges corrupted by additive Gaussian noise J. Canny, A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis and Machine Intelligence, 8: , 1986. 22,000 citations! Source: L. Fei-Fei

24 Example original image (Lena)

25 Compute Gradients (DoG)
X-Derivative of Gaussian Y-Derivative of Gaussian Gradient Magnitude

26 Get Orientation at Each Pixel
Threshold at minimum level Get orientation theta = atan2(gy, gx)

27 Non-maximum suppression for each orientation
At q, we have a maximum if the value is larger than those at both p and at r. Interpolate to get these values. Source: D. Forsyth

28 Before Non-max Suppression

29 After Non-max Suppression

30 Hysteresis thresholding
Threshold at low/high levels to get weak/strong edge pixels Do connected components, starting from strong edge pixels

31 Final Canny Edges

32 Source: D. Lowe, L. Fei-Fei
Canny edge detector Filter image with x, y derivatives of Gaussian Find magnitude and orientation of gradient Non-maximum suppression: Thin multi-pixel wide “ridges” down to single pixel width Thresholding and linking (hysteresis): Define two thresholds: low and high Use the high threshold to start edge curves and the low threshold to continue them Source: D. Lowe, L. Fei-Fei

33 Feature detection and matching

34 Reading Szeliski: 4.1

35 Motivation: Automatic panoramas
Credit: Matt Brown

36

37


Download ppt "Lecture 8: Edges and Feature Detection"

Similar presentations


Ads by Google