Download presentation
Presentation is loading. Please wait.
Published byHolly Wilkins Modified over 9 years ago
1
Session 2 – Hough Transformation Ashay Tejwani
2
Video Processing In the last session we saw that an image can be represented by an array of RGB values. In video processing we: Break down the video into separate frames Extract each image as an array Simply apply the relevant image processing techniques.
4
Why do we need it? Consider assessing this image:
5
So what does it do? Useful for detecting Parametric curves (such as lines, circles, conics). Relatively unaffected by: Gaps Noise
6
The theory behind Hough Transform
7
An Example Using Edge Detection Algorithm 1 1 2 2 4 4 5 5 3 3
8
Let us consider a coordinate system 1 1 2 2 4 4 5 5 3 3 X Y
9
Represent all lines in terms of R and Theta Convention 4 4 5 5 X Y 1 1 2 2 3 3
10
Procedure Select one point at a time, and consider all the combinations of R and Theta for which the line would pass through the given point. 4 4 5 5 X Y 1 1 2 2 3 3
11
Limits Before we start off, we need to set a limit to the max and min values of R and Theta. Min R=0, Max R= image diagonal Min Theta=-90 Max Theta=+90 4 4 5 5 X Y 1 1 2 2 3 3 (142,142) (0,100)
12
An Example R=Xcos(Θ) + Y sin(Θ) For point 1, all lines will have R=0 4 4 5 5 X Y 1 1 2 2 3 3 (142,142) (0,100)
13
An Example For Point 2, R=100, Theta=0 R=70.7, Theta=45 For Point 3, R=100, Theta=90 R=70.7, Theta=45 Plotting these in the 2-D array: 4 4 5 5 X Y 1 1 2 2 3 3 (142,142) (0,100)
14
Plotting acceptable R- Θ pairs R ThetaTheta R max Theta max Theta min R min
15
Result The points of intersection of these plots give us a value of R and Θ. These R and Θ represent the lines passing through the two points.
16
Open CV style
17
The logic- Voting! We create a 2-D matrix of all possible R and Θ values. For each edge point you detect, consider all the valid values of R and Θ. Increment the element of the array by 1 each time it is valid for a point – Each point ‘votes’ for a valid line.
18
Which is equivalent to converting this into a matrix R ThetaTheta R max Theta max Theta min R min
19
This matrix represents Hough Space Theta R 0000000000 0000000111 0000001000 0000010000 1111111 0101000010 000000100 1101001000 0000110000
20
Result From this array, we find all local Maxima. These correspond to the pair of R- Θ of lines which pass through the given group of points.
21
Algorithm For all X{ For all Y{ if(edge point at (x,y)){ for all theta{ R= x*cos(theta) + y*sin(theta); increment one to the cell in the matrix corresponding to R, theta. End all loops
22
Practical usage
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.