Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 376b Introduction to Computer Vision 04 / 14 / 2008 Instructor: Michael Eckmann.

Similar presentations


Presentation on theme: "CS 376b Introduction to Computer Vision 04 / 14 / 2008 Instructor: Michael Eckmann."— Presentation transcript:

1 CS 376b Introduction to Computer Vision 04 / 14 / 2008 Instructor: Michael Eckmann

2 Michael Eckmann - Skidmore College - CS 376b - Spring 2008 Today’s Topics Comments/Questions Hough transform for detecting equations of –lines in the image –circles in the image –etc.

3 Edges and Lines We know how to find edges in images and how Canny thins and connects them into line segments. What do we end up with after the Canny edge detector? –a binary image with edge pixels on and non-edge pixels off –and ideally many of the edge pixels are connected to neighboring edge pixels forming borders If we wanted to detect borders of shapes such as lines or circles in an image, we could use an edge detector as a the first step, but then we'd like to determine –if any shapes appear in the image and if so how many –and the equation of the shapes –and where they are

4 Edges and Lines The edge image can have various problems when it comes to storing complete shapes –connected edge pixels, even from Canny, can have gaps due to noise, occlusion, lighting, low contrast example on the board of a slotted back chair We want to group these edges into various shapes like lines and circles.

5 Hough Transform A method for detecting straight lines and circles and other curves from intensity images. Input: –the family of curves being sought Output: –the set of curves of that family found in the image e.g. if you're looking for lines, the hough transform will give you the equations of the lines appearing in the image

6 Hough Transform The equation of a line y = mx + b has two unknown parameters m and b. x and y are the coordinates of pixels making up that line. The number of unknown parameters of the family of curves being sought denotes the number of dimensions of an Accumulator array used by Hough. So in the line case, the number of dimensions of the accumulator is 2. A[M,B] is the value of the accumulator array for a particular quantized m and b.

7 Hough Transform y = mx + b is problematic in that it cannot describe vertical lines. An alternative equation is d = x cos(theta) + y sin(theta)‏ d is the perpendicular distance from the line to the origin theta is the angle between perpendicular and the x-axis diagram on the board

8 Hough Transform y = mx + b is problematic in that it cannot describe vertical lines. An alternative equation is d = x cos(theta) + y sin(theta)‏ d is the perpendicular distance from the line to the origin theta is the angle between perpendicular and the x-axis In an image, the origin is at the top left and rows are positive going down from there, so we change the equation to: d = c cos(theta) - r sin(theta)‏ How many dimensions will our accumulator array have?

9 Hough Transform The general procedure is as follows –given the number of parameters in the family of curves being sought, create an accumulator array of that many dimensions and choose the bins by deciding how you wish to quantize the parameters e.g. if you want accuracy of angle theta up to 10 degrees you can quantize the angle to 36 different values our text shows in figure 10.21 the accumulator array for a 256x256 image. The indices for angle being 0,10,20,..., 350 and for d being 0,3,6,9,...,360. Why is this only for a 256x256?

10 Hough Transform The general procedure is as follows –given the number of parameters in the family of curves being sought, create an accumulator array of that many dimensions and choose the bins by deciding how you wish to quantize the parameters –gather evidence for each edge at a pixel (and its neighborhood) determine what line best fits to that edge (that is, compute d and theta)‏ increment the accumulator array element at indices d,theta (either increment by 1 or by the magnitude of the edge)‏ –if want to give weight to higher magnitude lines on influencing the lines to be found

11 Hough Transform The general procedure is as follows –then after each pixel is considered and the accumulator array holds the evidence of lines the accumulator array is examined for peaks. –The peaks in the accumulator array tell us the most likely equations of lines that appear in the image. The line equations are for infinite length lines. If you wanted to know where the line segments start and stop, you can keep track of a point list for each quantized parameter d and theta.

12 Hough Transform Let's flesh out one of the parts of the procedure How to determine what line best fits to an edge pixel (that is, compute d and theta)‏ of d = c cos(theta) - r sin(theta)‏ –We find edges by computing the gradient. For example, the 2 Prewitt masks each compute portions of the gradient. One computes the change in the x direction the other in the y direction. We combine these to get the gradient magnitude and direction. –The direction (the angle) is the theta in the equation. It is the arctan of the change w.r.t. y divided by the change w.r.t. x. –What else do we need to do? How to do it? –see p. 146

13 Hough Transform Let's look at Algorithm 10.7 on page 306 and then if there's time, the example in figure 10.22 on p. 307.


Download ppt "CS 376b Introduction to Computer Vision 04 / 14 / 2008 Instructor: Michael Eckmann."

Similar presentations


Ads by Google