Screenshots     Download     Documentation     Tutorials     Partners     Resources     Contact     Forum     Search  

 

Hough

The Hough transform is a technique for creating lines based on points. The results of a typical edge detection routine are many unconnected points. To us it is obvious that these points represent shapes but because the points are not connected it is difficult for a machine to understand the underlying shape. The Hough transform takes as input many points and will generate guesses for what lines those points represent.

The Hough module interface shows the parameter space image that represents the Hough transform in a visual manner. The image axis are the angular amount (theta) and the distance value (r) used to represent a line using polar notation "r = x cos(theta) + y sin(theta)" as apposed to coordinate notation "y = m x + b". The Hough transform converts potential lines into peaks within this image. The task of detecting lines now instead becomes a task of detecting peaks within this image. The interface below shows red squares around those detected peaks which indicate the parameters (theta,r) of the lines seen in the below example. By thresholding and isolating these peaks it is possible to get a reasonably good approximation of the actual figure (source image -> Hough transform).

For a detailed description of how the Hough transform works see the links below.

Interface

Instructions

1. To use the Hough transform it is typical to first use an edge detection routine like the Sobel Edge. This helps identify points to use in the transform and can speed up processing by eliminating points (i.e. setting them to black) that do not need to be processed.
2. Decrease the "Threshold" number field or scroll the horizontal scroller until a number of lines appear in the image
3. Often many lines that are detected are very close in slope and proximity to each other and can create a meaningless image. Use the peak isolation number to remove lines close to each other. See below for a visual example.
4. If selecting the module causes your machine to hang use the "Precision" to reduce the computational load on your machine. The Hough transform is VERY cpu intensive and not all the points need to be analyzed in order for a useful result to appear. Changing the "Precision" value will reduce the number of points used in the transform.
5. "Bound Lines" attempts to reduce the lines to within the objects boundary
6. "Overlay Source" will draw the lines ontop of your source image to help you understand why lines are appearing
7. If you have a gradient image (as apposed to a binary image) then checking the gradient will cause the transform to take into account the intensity of the edge. Thus strong edges will result in a higher peak value than weak edges which can make threshold detection easier.
8. Select the color that the lines will be draw in (and also the peak indicators).

Example

SourceHough Lines
Hough Lines with peak isolation of 1Hough Lines with threshold of 0

Variables

HOUGH_LINES - contains the top 10 lines found from the Hough transform. Using code similar to the following within a VBScript module will allow you to further process the line segments.

    line = GetArrayVariable("HOUGH_LINES")

    ' write back to messages the first line ..
    ' note that line segments are defined by two endpoints
    Write("First Coord: " & line(0) & "," & line(1) & vbCRLF)
    Write("Second Coord: " & line(2) & "," & line(3))

For more information


HIPR2 - Hough Transform
HIPR2 - Interactive Hough Transform
Sussex Computer Vision - HOUGH TRANSFORMS
Mimas Hough Transform
CVonline: Hough Transform

© 2008 RoboRealm. All Rights Reserved. | Contact | Glossary | Privacy | Disclaimer | Link to Us | Resources | Site Map