• Save
Edges and lines
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Edges and lines

on

  • 824 views

 

Statistics

Views

Total Views
824
Views on SlideShare
824
Embed Views
0

Actions

Likes
1
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • How to fix?
  • Is this filter separable?
  • Figure 15.1, top half. Note that most points in the vote array are very dark, because they get only one vote.
  • This is 15.1 lower half
  • This is 15.1 lower half
  • This is the number of votes that the real line of 20 points gets with increasing noise (figure15.3)
  • 15.2; main point is that lots of noise can lead to large peaks in the array
  • Figure 15.4; as the noise increases in a picture without a line, the number of points in the max cell goes up, too

Edges and lines Presentation Transcript

  • 1. Edges and Lines
  • 2. Edge detection • Goal: Identify sudden changes (discontinuities) in an image – Intuitively, most semantic and shape information from the image can be encoded in the edges – More compact than pixels • Ideal: artist’s line drawing (but artist is also using object-level knowledge) Source: D. Lowe
  • 3. Why do we care about edges?• Extract information, recognize objects Vertical vanishing point (at infinity) Vanishing• Recover geometry and line viewpoint Vanishing Vanishing point point
  • 4. Origin of Edges surface normal discontinuity depth discontinuity surface color discontinuity illumination discontinuity • Edges are caused by a variety of factors Source: Steve Seitz
  • 5. Closeup of edges Source: D. Hoiem
  • 6. Closeup of edges Source: D. Hoiem
  • 7. Closeup of edges Source: D. Hoiem
  • 8. Closeup of edges Source: D. Hoiem
  • 9. Characterizing edges• An edge is a place of rapid change in the image intensity function intensity function image (along horizontal scanline) first derivative edges correspond to extrema of derivative
  • 10. With a little Gaussian noise Gradient Source: D. Hoiem
  • 11. Effects of noise • Consider a single row or column of the image – Plotting intensity as a function of position gives a signal Where is the edge? Source: S. Seitz
  • 12. Effects of noise• Difference filters respond strongly to noise – Image noise results in pixels that look very different from their neighbors – Generally, the larger the noise the stronger the response• What can we do about it? Source: D. Forsyth
  • 13. Solution: smooth first f g f*g d ( f ∗ g) dx d• To find edges, look for peaks in ( f ∗ g) dx Source: S. Seitz
  • 14. Derivative theorem of convolution• Differentiation is convolution, and convolution is d d associative: ( f ∗ g) = f ∗ g dx dx• This saves us one operation: f d g dx d f∗ g dx Source: S. Seitz
  • 15. Derivative of Gaussian filter * [1 -1] =
  • 16. 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
  • 17. 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
  • 18. Canny edge detector • This is probably the most widely used edge detector in computer vision • Theoretical model: step-edges corrupted by additive Gaussian noise • Canny has shown that the first derivative of the Gaussian closely approximates the operator that optimizes the product of signal- to-noise ratio and localizationJ. Canny, A Computational Approach To Edge Detection, IEEETrans. Pattern Analysis and Machine Intelligence, 8:679-714, 1986. Source: L. Fei-Fei
  • 19. Example original image (Lena)
  • 20. Derivative of Gaussian filter x-direction y-direction
  • 21. Compute Gradients (DoG)X-Derivative of Gaussian Y-Derivative of Gaussian Gradient Magnitude
  • 22. Get Orientation at Each Pixel• Threshold at minimum level• Get orientation theta = atan2(gy, gx)
  • 23. 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
  • 24. Before Non-max Suppression
  • 25. After non-max suppression
  • 26. Hysteresis thresholding• Threshold at low/high levels to get weak/strong edge pixels• Do connected components, starting from strong edge pixels
  • 27. Hysteresis thresholding• Check that maximum value of gradient value is sufficiently large – drop-outs? use hysteresis • use a high threshold to start edge curves and a low threshold to continue them. Source: S. Seitz
  • 28. Final Canny Edges
  • 29. Canny edge detector1. Filter image with x, y derivatives of Gaussian2. Find magnitude and orientation of gradient3. Non-maximum suppression: – Thin multi-pixel wide “ridges” down to single pixel width4. 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• MATLAB: edge(image, ‘canny’) Source: D. Lowe, L. Fei-Fei
  • 30. Effect of σ (Gaussian kernel spread/size)original Canny with Canny withThe choice of σ depends on desired behavior • large σ detects large scale edges • small σ detects fine features Source: S. Seitz
  • 31. Learning to detect boundaries image human segmentation gradient magnitude • Berkeley segmentation database: http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/segbench/
  • 32. Finding straight lines• One solution: try many possible lines and see how many points each line passes through• Hough transform provides a fast way to do this
  • 33. Hough transform• An early type of voting scheme• General outline: – Discretize parameter space into bins – For each feature point in the image, put a vote in every bin in the parameter space that could have generated this point – Find bins that have the most votes Image space Hough parameter space P.V.C. Hough, Machine Analysis of Bubble Chamber Pictures, Proc. Int. Conf. High Energy Accelerators and Instrumentation, 1959
  • 34. Parameter space representation• A line in the image corresponds to a point in Hough space Image space Hough parameter space Source: S. Seitz
  • 35. Parameter space representation • What does a point (x0, y0) in the image space map to in the Hough space? Image space Hough parameter space
  • 36. Parameter space representation • What does a point (x0, y0) in the image space map to in the Hough space? – Answer: the solutions of b = –x0m + y0 – This is a line in Hough space Image space Hough parameter space
  • 37. Parameter space representation • Where is the line that contains both (x0, y0) and (x1, y1)? Image space Hough parameter space (x1, y1) (x0, y0) b = –x1m + y1
  • 38. Parameter space representation • Where is the line that contains both (x0, y0) and (x1, y1)? – It is the intersection of the lines b = –x0m + y0 and Image –x m + b = space y1 Hough parameter space 1 (x1, y1) (x0, y0) b = –x1m + y1
  • 39. Parameter space representation• Problems with the (m,b) space: – Unbounded parameter domain – Vertical lines require infinite m
  • 40. Parameter space representation• Problems with the (m,b) space: – Unbounded parameter domain – Vertical lines require infinite m• Alternative: polar representation x cosθ + y sinθ = ρ Each point will add a sinusoid in the (θ,ρ) parameter space
  • 41. Algorithm outline • Initialize accumulator H to all zeros • For each edge point (x,y) ρ in the image For θ = 0 to 180 ρ = x cos θ + y sin θ H(θ, ρ) = H(θ, ρ) + 1 θ end end • Find the value(s) of (θ, ρ) where H(θ, ρ) is a local maximum – The detected line in the image is given by ρ = x cos θ + y sin θ
  • 42. Basic illustration features votes
  • 43. Other shapes Square Circle
  • 44. Several lines
  • 45. A more complicated image http://ostatic.com/files/images/ss_hough.jpg
  • 46. Effect of noise features votes
  • 47. Effect of noise features votes • Peak gets fuzzy and hard to locate
  • 48. Effect of noise• Number of votes for a line of 20 points with increasing noise:
  • 49. Random points features votes• Uniform noise can lead to spurious peaks in the array
  • 50. Random points• As the level of uniform noise increases, the maximum number of votes increases too:
  • 51. Dealing with noise• Choose a good grid / discretization – Too coarse: large votes obtained when too many different lines correspond to a single bucket – Too fine: miss lines because some points that are not exactly collinear cast votes for different buckets• Increment neighboring bins (smoothing in accumulator array)• Try to get rid of irrelevant features – Take only edge points with significant gradient magnitude
  • 52. Incorporating image gradients• Recall: when we detect an edge point, we also know its gradient direction• But this means that the line is uniquely determined!• Modified Hough transform:• For each edge point (x,y) θ = gradient orientation at (x,y) ρ = x cos θ + y sin θ H(θ, ρ) = H(θ, ρ) + 1 end
  • 53. Hough transform for circles• How many dimensions will the parameter space have?• Given an oriented edge point, what are all possible bins that it can vote for?
  • 54. Hough transform for circles image space Hough parameter spacey r ( x , y ) + r∇ I ( x , y ) (x,y) x ( x , y ) − r∇ I ( x , y ) x y
  • 55. Hough transform for circles • Conceptually equivalent procedure: for each (x,y,r), draw the corresponding circle in the image and compute its “support” r x yIs this more or less efficient than voting with features?
  • 56. Finding straight lines• Another solution: get connected components of pixels and check for straightness
  • 57. Finding line segments using connected components1. Compute canny edges – Compute: gx, gy (DoG in x,y directions) – Compute: theta = atan(gy / gx)2. Assign each edge to one of 8 directions3. For each direction d, get edgelets: – find connected components for edge pixels with directions in {d-1, d, d+1}• Compute straightness and theta of edgelets using eig of x,y 2nd moment matrix of their points ∑ ( x − µ x ) ( y − µ y ) Larger eigenvector  ∑( x − µx )2M=  [ v, λ] = eig(Μ ) ∑ ( x − µ x ) ( y − µ y ) ∑( y − µ ) θ = atan 2( v(2,2), v(1,2)) 2  y   conf = λ2 / λ1• Threshold on straightness, store segment Slides from Derek Hoiem
  • 58. 1. Image  Canny
  • 59. 2. Canny lines  … straight edges
  • 60. Comparison Hough Transform Method Connected Components Method