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

CVI_Week_4_1_Pre_Note

The document discusses the Hough Transform, a method used in computer vision for detecting lines and circles in images by transforming edge points from image space to parameter space. It explains the parameterization of lines and circles, the voting mechanism for edge points, and the robustness of the Hough Transform against noise and occlusion. The document also outlines the process for detecting lines and circles, including the initialization of bins and accumulation of votes in parameter space.

Uploaded by

gfd45yjz79
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

CVI_Week_4_1_Pre_Note

The document discusses the Hough Transform, a method used in computer vision for detecting lines and circles in images by transforming edge points from image space to parameter space. It explains the parameterization of lines and circles, the voting mechanism for edge points, and the robustness of the Hough Transform against noise and occlusion. The document also outlines the process for detecting lines and circles, including the initialization of bins and accumulation of votes in parameter space.

Uploaded by

gfd45yjz79
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Hough transform

Akila Subasinghe
School of Computer Science
University of Birmingham

[Computer Vision and Imaging]


The representation of the world
• One important way that we recognise shapes is through mathematical functions that
describe the boundary curves

Math?

Pixels Intensity gradient Edge map


From edge to line
• After edge detection, we get a binary edge map, which contains a set of edge points
(𝑥i,𝑦i)𝑖=1,2,⋯,𝑁 .
• If these edge points belong to a line, how can we get a parametric representation of the line?
• A well-known method of utilising this kind of information in computer vision is the Hough
Transform, named after Paul Hough who patented the method in 1962
Line parameterisation
• For example, a line can be represented by 𝑦 = 𝑚𝑥 + 𝑏, i.e. just two parameters 𝑚 and 𝑏.
• This is a much more efficient representation than a lot of edge points.
Line parameterisation
Slope intercept form

: Slope
: y-intercept
Normal form

: Angle
: Distance from the origin
Hough transform
• Hough transform is a transform from image space to parameter space (e.g. from an
edge map to parameters of a line).
• Its output is a parametric model, given the input edge points.
• The basic idea is that each edge point votes for possible parameters in the parameter
space.
Hough transform – with slope intercept
form
• Let us use the slope intercept form for a line model

• We have edge points in the image space 𝑥 , 𝑦 , 𝑥 , 𝑦 , 𝑥 , 𝑦 ,…


• Each point votes for a line model in the parameter space
• For example, the first point will vote for 𝑏 = 𝑦 − 𝑚𝑥

Image space Parameter space (Hough space)


Hough transform – with slope intercept
form

Image space Parameter space (Hough space)


Hough transform – with slope intercept
form
• In practice, the parameter space is divided into 2D bins.
• Each point increments the vote by 1 in one of the bins.
Hough transform – with slope intercept
form
The parameter space is too large, 𝑚 ∈ −∞, +∞ , 𝑏 ∈ [−∞, +∞]. We need a lot of bins.
Hough transform – with normal form
• Solution is using normal form

• We can use much fewer bins 𝜌 ∈ −∞, +∞ , 𝜃 ∈ [0, 𝜋]


• In practice 𝜌 is not infinite either. It is limited by the image size
Hough transform – with normal form
The transform from image space to parameter space will look different

Image space Parameter space (Hough space)


Line detection by Hough transform
• Initialise the bins H(𝜌, 𝜃) to all zeros
• For each edge point 𝑥, y :
For 𝜃 from 0 to 𝜋:
1. Calculate 𝜌 = 𝑥 𝑐𝑜𝑠 𝜃 + y sin 𝜃
2. Accumulate H 𝜌, 𝜃 = H 𝜌, 𝜃 + 1
• Find(𝜌, 𝜃), where H 𝜌, 𝜃 is a local maximum and larger than a threshold.
• The detected lines are given by 𝜌 = 𝑥 𝑐𝑜𝑠 𝜃 + y sin 𝜃
Line detection by Hough transform
• Initialise the bins H(𝜌, 𝜃) to all zeros
• For each edge point 𝑥, y :
Similar as non-maximum
For 𝜃 from 0 to 𝜋: suppression in edge detection
1. Calculate 𝜌 = 𝑥 𝑐𝑜𝑠 𝜃 + y sin 𝜃
2. Accumulate H 𝜌, 𝜃 = H 𝜌, 𝜃 + 1
• Find(𝜌, 𝜃), where H 𝜌, 𝜃 is a local maximum and larger than a threshold.
• The detected lines are given by 𝜌 = 𝑥 𝑐𝑜𝑠 𝜃 + y sin 𝜃

A few random points would not lead to a line being


detected
Line detection by Hough transform
Canny edge detection
Image

Line detection
using Hough
transform
Hough transform
Hough transform can simultaneously detect multiple lines, as long as they are local
maxima above a threshold

Image Edge map Parameter space Detected lines


(Hough space)
Hough transform
It is robust to noise. Broken edge points can still vote and contribute to line detection.

Image Edge map Parameter space Detected lines


(Hough space)
Hough transform
It is robust to object occlusion. The remaining edge points still contribute to line detection.

Image Edge map Parameter space Detected lines


(Hough space)
Circle detection by Hough transform
• We can parameterise a circle as,

• The image space (𝑥, 𝑦) is transformed to the parameter space (𝑎, 𝑏, 𝑟)


• This is a very large search space (a lot of bins).
However, if we know the radius 𝑟, it would be easier.
Circle detection by Hough transform

• If the radius 𝑟 is known, then for each edge point (𝑥, 𝑦) , we only need to vote for
possible values of (𝑎, 𝑏)

• It is a circle in the parameter space H(𝑎, 𝑏)


Circle detection by Hough transform

Image space Parameter space (Hough space)


Circle detection by Hough transform
• If the radius 𝑟 is unknown, then it is a 3D parameter space H(𝑎, b, r)
• We set a range for the radius 𝑟.
For each 𝑟 ∈ [𝑟 ,𝑟 ]:
For each edge point 𝑥, y :
We vote for possible values of 𝑎, b and accumulate H(𝑎, b, r)
• For example, we can start from 𝑟 = 1 pixel to 10 pixels, each time increasing by 1 pixel.
Circle detection by Hough transform
• Parametric form using trigonometric functions

• This form gives us some ideas for acceleration.


• If we know the angle 𝜃 (direction) from the edge point 𝑥,𝑦 to the circle centre (𝑎, 𝑏) , we
can more accurately vote in the parameter space.
Circle detection by Hough transform

If 𝜃 is unknown,
we vote for the
whole circle

Image space Parameter space (Hough space)


Circle detection by Hough transform

If we know 𝜃 we
only vote for
along this
direction.

Image space Parameter space (Hough space)


Circle detection by Hough transform
Since this is an
If we know 𝜃 we
edge point, we
know its direction only vote for
along this
direction.

Image space Parameter space (Hough space)


Circle detection by Hough transform
• Initialise the bins 𝐻(𝑎, 𝑏, 𝑟) to all zeros
• For each possible 𝑟 ∈ [𝑟 ,𝑟 ]:
For each edge point 𝑥, y ∶
Let 𝜃 to be gradient direction, or opposite gradient
Calculate 𝑎 = 𝑥 − 𝑟 𝑐𝑜𝑠 𝜃 , 𝑏 = 𝑦 − 𝑟 𝑠𝑖𝑛 𝜃
Accumulate 𝐻 𝑎, 𝑏, 𝑟 = 𝐻 𝑎, 𝑏, 𝑟 + 1
• Find 𝑎, 𝑏, 𝑟 , where 𝐻 𝑎, 𝑏, 𝑟 is a local maximum and larger than a threshold.
• The detected circle are given by 𝑥 = 𝑎 + 𝑟 𝑐𝑜𝑠 𝜃 , 𝑦 = 𝑏 + 𝑟 𝑠𝑖𝑛 𝜃
Circle detection by Hough transform
Summary
• Hough transform
• Line detection by Hough transform
• Circle detection by Hough transform

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy