Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 5 Hough transform and RANSAC

Similar presentations


Presentation on theme: "Lecture 5 Hough transform and RANSAC"— Presentation transcript:

1 Lecture 5 Hough transform and RANSAC
Slides by: David A. Forsyth Clark F. Olson

2 Further abstraction Even after edge detection we may have more information than we want. How can we abstract this even further? Choose a parametric object to represent a set of pixels Example: a line (or segment) can represent a set of edge pixels Other possibilities include circles and complex structures

3 Fitting After deciding what representation you are using, there are three main questions: How many objects are there? To which of the objects does each pixel belong (if any)? What parameters best represents each of the objects?

4 Curve extraction One way to extract curves is to link edge pixels together. A junction (3-way intersection) indicates a break point. Can fit curves with model (line, conic section, etc.) after extraction. However, this doesn’t usually work that well: Edges are broken by areas of low contrast Junctions are often missed by edge detectors Another bad idea: test all possible lines (or other shape).

5 Incremental line fitting

6 The Hough transform The Hough transform is an important method for detecting structure (originally lines, but much more general). The basic idea is to examine the parameter space for lines, rather than the image space, by mapping pixels in the image into the parameter space.

7 Line parameterizations
A line is the set of points (x, y) such that: y = mx + b (slope-intercept) or (sin θ) x + (cos θ) y + ρ = 0 (rho-theta) (Two common ways to parameterize a line.)

8 The Hough transform Different choices of m, b (or q, ρ) give different lines. For any (x, y) there is a one parameter family of lines through this point. Each point gets to vote for each line in the family; if there is a line that has lots of votes, that should be the line passing through the points

9 Example ρ y x θ pixels votes
Figure 15.1, top half. Note that most points in the vote array are very dark, because they get only one vote. x pixels θ votes

10 Mechanics of the Hough transform
Construct an array representing q, ρ. For each point, render the curve (q, ρ) into this array, adding one at each cell ρ y pixels x votes θ

11 Mechanics of the Hough transform
Issues: How big should the cells be? If too big, we can’t distinguish between different lines. If too small, noise causes lines to be missed. How many lines? Count the peaks in the array. Who belongs to which line? Tag the votes, or post-process.

12 Example with noise ρ y This is 15.1 lower half x pixels votes θ

13 Random data ρ y x θ pixels votes
15.2; main point is that lots of noise can lead to large peaks in the array x pixels votes θ

14 Hough transform algorithm
Construct parameter space voting array (bins). For each edge pixel in image: Increment counter for each bin consistent with pixel. For each bin in voting array: Determine if sufficient votes exist (and local maximum). If so, output line.

15 Variations Can use pairs of points to vote in parameter space
- Two points are consistent with only one line Can use the edge gradient to reduce the number of bins consistent with an edge pixel - One point plus orientation is consistent with only one line Same ideas can be applied to many other structures: - Circles - Conic sections - Arbitrary 2D shapes - Three-dimensional objects

16 RANSAC RANSAC (RANdom SAmple Consensus) is a useful algorithm using Monte Carlo sampling. Choose a small subset uniformly at random Fit the selected subset Anything else that is close to this fit is included Refit Do this many times and choose the best fits This algorithm contains concepts that are hugely useful; in my experience, everyone with some experience of applied problems who doesn’t yet know RANSAC is almost immediately able to use it to simplify some problem they’ve seen.

17 RANSAC Issues: How big a subset? - Usually smallest possible
How many times? - Often enough that we are likely to have a good line How close is “close enough”? - Depends on the problem


Download ppt "Lecture 5 Hough transform and RANSAC"

Similar presentations


Ads by Google