# Differences

This shows you the differences between two versions of the page.

hough_transform [2011/12/05 19:50]
oestape
hough_transform [2011/12/11 08:27] (current)
oestape
Line 1: Line 1:
====== Hough transform for line detection ====== ====== Hough transform for line detection ======
-[[wp>Hough transform|Hough transform]] for line detection helps to find lines in an image even if the points are not connected and the lines are not perfectly straight. It works with a voting procedure where each point in the image votes for all the possible lines that pass through it. The line with more votes corresponds to the most likely line.+[[wp>Hough transform|Hough transform]] for line detection helps to find lines in an image even if the points are not connected and the lines are not perfectly straight. It works with a voting procedure where each point in the image votes for all the possible lines that pass through it. The line with more votes corresponds to the most likely one.
-In the following applet you can draw anything at the left and see the transformed image at the right. Each point in the original image contributes to many points (a curve) in the transformed image, and each point in the transformed image represents a straight line in the original image (you can move the mouse there to see it). The brightest points in the transformed image are likely to be caused by a straight line in the original image.+In the following applet you can draw anything on the left and see the transformed image on the right. Each point in the original image contributes to many points (a curve) in the transformed image, and each point in the transformed image represents a straight line in the original image (you can move the mouse there to see it). The brightest points in the transformed image are likely to be caused by a straight line in the original image.
{{processing>720x360:HoughDemo8}} {{processing>720x360:HoughDemo8}}
Line 59: Line 59:
{{ :hough_transform_noise.png |Hough transform of random noise}} {{ :hough_transform_noise.png |Hough transform of random noise}}
+
+There are many variations of the Hough transform, that are used for circle detection or generic shape detection, but they are more complex and the transformed image (the "parameter space") has more than two dimensions and it would be difficult to visualize it here.
+
+In OpenCV, the function cvHoughLines2() with the CV_HOUGH_STANDARD mode implements the same line detection that we have been talking about, except that it returns the detected lines and not the transformed image. It can find line segments as well using the CV_HOUGH_PROBABILISTIC mode. The function cvHoughCircles() finds circles of any radius in an image. 