Hough Transform for detecting Straight Lines

 

 
 
 

The various results obtained by me as results of applying the line detection routine is shown below.The detected lines are marked in red.
Edge Linking Pixels appear in green.
 

The routine has two options :

The first one is to detect general line directions which results in the detection of the infinite lines in the direction of the lines
present in the image.If the accumulator threshold is reduced the number of lines detected increases as is expected.
 

Original Image
Accumulator Maxima 85
A plot of the 
Hough Parameter Space
General Line Directions detected 
Accumulator Threshold 40
General Line Directions detected 
Accumulator Threshold 25

The second option is to detect the actual line segments present in the image. This however requires the use of the gradient image
which has been computed here using Sobel's Operator (This facility is included in the Hough routines).Another facility is to attempt
edge linking - The routines tries to link together pieces of the same line which are within a certain distance threshold, using a kind
of edge relaxation technique.
 
The Gradient Image
Gradient Threshold  0.6
The individual line segments detected
The detected segments linked 
Linking pixels are shown in green

 

Next, I demonstrate the Hough transform's capbility of detecting straight lines from amongst other shapes.
 
Original Image
Accumulator Maxima 120 (after gradient)
Gradient Image
Gradient Threshold  0.6
A plot of the 
Hough Parameter Space
The longest segment detected
Accumulator Threshold 110

 
 

Next, I demonstrate the Hough transform's capability of detecting straight lines in noisy images.
 
Original Image
Accumulator Maxima 65
A plot of the 
Hough Parameter Space
The detected line segments
Accumulator Threshold 40

 
 

Now, I  demonstrate the Hough Transform's cpability on a real life image. The image is of the NASA Dryden Flight Research Center.
The Hough transform is used to detect a major road segment as shown.
 
 
The NASA Dryden Flight Research Center.
Accumulator Maxima 312 (after gradient)
The Gradient Image
Gradient Threshold  0.9
The detected road segment marked in red

Other Experiments possible :

1.    The accumulator resolution and quantization can both be varied and the results studied.
2.    Each edge point can be made to vote for a neighbourhood of cells in the accumulator insted of just on cell and the effect studied.
 
 

Salient Features of this Implementation :

1. Highly efficient due to pre-calculation of Sin and Cos tables.

2. Very Interactive - allows the user to vary a lot of parameters at runtime such as -
    a) The choice of calculating the Gradient Image
    b) The Gradient Threshold
    c) The choice of plotting the Hough Parameter Space
    d) The Accumulator Threshold (The routine reports the accumulator Maxima for easy selection of this threshold).
    e) The choice of detecting general line directions or actual line segments
    f) The choice of performing edge linking.

3. Though the Accumulator quantization is fixed to 1 pixel for 'rho' and 1 radian for 'theta', these are very clearly documented
   and can be easily changed in the source code.

4. Auto selection of suitable accumulator resolution (If the quantization is changed this adjusts automatically).




Page last updated on 28 January, 2004. pialpharhoalphagammaAT cse.iitd.ac.in © Parag Chaudhuri , 2009
DCSE, IIT Delhi Valid HTML 4.0! Valid CSS! yahoo