Week 3 - Hough Transforms Flashcards
How do we rearrange a line equation for hough lines
To c = -mx + y
We can then plug in (x,y) values to find where all the possible lines that cross through these x,y values
can find a (x,y) where they all cross and get the line equation from it y = mx + c
How do we find hough line intercepts programmatically
With the same c = -mx + y equations
Create an accumulator array of m going across, c going down
1) all values initially 0
2) plot each equation into the array using 1s to show it is a point on a line
3) when two lines are plot at the same point, increment (says 2 instead)
4) choose the entry with the highest value - we can decide on threshold value; minimum no. of points that we will consider a valid line
Put coordinates back into y = mx +c
What happens in the array if the line is vertical
m = ∞, line has an infinite gradient and the array cannot manage this
What is the polar equation for r
r = x cos(θ) + y sin(θ)
How do we set up an array using polar coordinates
theta along the top, r going down
Use the same method of incrementing interceptions
What happens to theta after reading it from the array
θ = 45* corresponds to the line θ = -45* because our array actually gives the angle from the normal (+ve x axis) clockwise through to our line which is actuall -ve
How do polar coordinates handle vertical lines
They wont read the gradient as infinity, just an angle θ=90*
Why are hough lines useful
Edge points are identified using techniques such as gradient-based methods (e.g., Sobel operator) or thresholding
We then create hough lines from these points and add them to an array
Peaks in the accumulator array correspond to potential lines in the image space
Why are hough circles useful
Help us detect circular images: car wheels or biscuits in an image
What is the equation of a circle
r² = (x - a)² + (y - b)²
From the equation of a circle, what is the centre coordinates
(a, b)
How do we rearrange the equation of a circle for a hough circle
(a - x)² + (b - y)² = r²
How do we find hough circle intercepts programmatically (fixed radius)
Use an accumulator array for a and b (a is horizontal)
Draw each circle into an array
Eg for point (2,3) a circle with fixed radius is drawn with centre at (2,3)
Increment each intercept
Highest value represents the circle centre (a,b)
What happens if the hough circles do not have fixed radii
Need a 3D accumulator array for a,b,r
What do bright points represent in detection images
a circle centre is correctly detected
play around with different r to find more bright points (more circle centres)