0% found this document useful (0 votes)
35 views

Line Detection

The document discusses techniques for line detection in images. It describes using masks to detect lines at different orientations by convolving the masks with the image. It then explains using the Hough transform, which works by quantizing a parameter space defined by the line equation and accumulating votes from edge points to find lines. It notes issues with the slope-intercept line representation and how the Hough transform instead uses a polar line representation to address these issues. Finally, it briefly discusses extending the Hough transform to detect other shapes like circles.

Uploaded by

ttogrul
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Line Detection

The document discusses techniques for line detection in images. It describes using masks to detect lines at different orientations by convolving the masks with the image. It then explains using the Hough transform, which works by quantizing a parameter space defined by the line equation and accumulating votes from edge points to find lines. It notes issues with the slope-intercept line representation and how the Hough transform instead uses a polar line representation to address these issues. Finally, it briefly discusses extending the Hough transform to detect other shapes like circles.

Uploaded by

ttogrul
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Line detection

- The masks shown below can be used to detect lines at various orientations

horizontal line
0 1 0 1 0 0 1 0 0 1 0

convolved image
6 6 -

mask
0 -1 2 -1 -1 2 -1 -1 2 -1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 -

* vertical line convolved image

-2- In practice, we run every mask over the image and we combine the responses: R(x, y) = max(|R1 (x, y)|, |R2 (x, y)|, |R3 (x, y)|, |R4 (x, y)|) If R(x, y) > T , then discontinuity

R1
-1 2 -1 -1 2 -1 -1 2 -1 -1 -1 2

R2
-1 2 -1 2 -1 -1 -1 -1 -1

R3
2 2 2 -1 -1 -1 2 -1 -1

R4
-1 2 -1 -1 -1 2

Original Image

Convolved Image with R1 (x,y)

Convolved Image with R2 (x,y)

Convolved Image with R3 (x,y)

Convolved Image with R4 (x,y)

MAX .
(x,y)

-3-

Using Hough Transform to detect lines


(Trucco, Chapt. 5)

- Consider the slope-intercept equation of line y = ax + b, (a, b are constants, x is a variable, y is a function of x) - Rewrite the equation as follows: b = xa + y (now, x, y are constants, a is a variable, b is a function of a)

- The following properties are true: Each point (x i , y i ) denes a line in the a b space (parameter space) Points lying on the same line in the x y space, dene lines in the parameter space which all intersect at the same point The coordinates of the point of intersection dene the parameters of the line in the x y space

-4Algorithm 1. Quantize the parameter space P[amin , . . . , amax ][bmin , . . . , bmax ] (accumulator array)

2. For each edge point (x, y) For(a = amin ; a amax ; a++) { b = xa + y; /* round off if needed * (P[a][b])++; /* voting */ } 3. Find local maxima in P[a][b] (If P[a j ][b k ]=M, then M points lie on the line y = a j x + b k )

-5-

Effects of quantization
- The parameters of a line can be estimated more accurately using a ner quantization of the parameter space - Finer quantization increases space and time requirements - For noise tolerance, however, a coarser quantization is better

b y y=ax+b

.. .. .. . .

(it is very likely that every point will cast a vote in the (a, b) cell)

Problem with slope-intercept equation


- The slope can become very large or even innity !! - It will be impossible to quantize such a large space

-6-

Polar representation of lines


xcos + ysin =

(if the line is vertical, =0, x = )

- The following properties are true:


Each point (x i , y i ) denes a sinusoidal curve in the space)

space (parameter

Points lying on the same line in the x y space, dene curves in the parameter space which all intersect at the same point The coordinates of the point of intersection dene the parameters of the line in the x y space

-7Algorithm 1. Quantize the parameter space P[ min , . . . , max ][ min , . . . , max ] (accumulator array)

2. For each edge point (x, y)


For( =

min ;

max ;

++) {

= xcos + ysin ; /* round off if needed *


(P[ ][ ])++; /* voting */ } 3. Find local maxima in P[ ][ ]

-8-

-9-

Extending Hough Transform


- Hough transform can also be used for detecting circles, ellipses, etc. - For example, the equation of circle is: (x x 0 )2 + (y y 0 )2 = r 2 - In this case, there are three parameters: (x 0 , y 0 ), r - In general, we can use hough transform to detect any curve which can be described analytically by an equation of the form: g(v, C) (v: vector of coordinates, C: parameters) - Detecting arbitrary shapes, with no analytical description, is also possible (Generalized Hough Transform)

You might also like