6

Does anyone know the particular algorithm for Probabilistic Hough Transform in the OpenCV's implementation? I mean, is there a reference paper or documentation about the algorithm?

To get the idea, I can certainly look into the source code, but I wonder if there is any documentation about it. -- it's not in the source code's comments (OpenCV 1.0).

Thank you!

-Jin

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
galactica
  • 1,753
  • 2
  • 26
  • 36

5 Answers5

7

The OpenCV documentation states that the algoithm is based on "Robust detection of lines using the progressive probabilistic hough transform", by J Matas et al. This is quite different from the RHT described on wikipedia.

The paper does not seem to be freely available on the internet, but you can purcahse it from Elsevier

vas
  • 71
  • 1
  • 2
2

The source code for HoughLinesProbabilistic in OpenCV 2.4.4 contains inline comments that explain the various steps involved.

https://github.com/Itseez/opencv/blob/master/modules/imgproc/src/hough.cpp

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
  • Please use permalinks when you link to GitHub. That file has changed since you posted that link and thus the line number is now irrelevant. GitHub doesn’t make it easy; you can press "y" on a file view to get the permalink. – bfontaine Oct 30 '16 at 19:40
1

The article Line Detection by Hough transformation in the section 6 could be useful.

tOnIp
  • 91
  • 1
  • 2
1

Here is a fairly concise paper by Matas et.al. that describes the approach, and as others mentioned, it is indeed quite different from Randomized Hough Transform:

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.40.2186&rep=rep1&type=pdf

(Not sure for how long this link is going to be valid though. It's on/from citeseer, wouldn't expect it to just vanish tomorrow, but who knows...)

I had quick look at the implementation icvHoughLinesProbabilistic() in hough.cpp, because I'll be using it :-) It seems fairly straightforward, anyway, my primary interest was whether it does some least squares line-fitting in the end - it doesn't, which is fine. It just means, if it is desired to get accurate line-segments, one may want to use the start/end-point and implied line-parameters as returned by OpenCV to select related points from the overall point-set. I'd be using a fairly conservative distance-threshold in the first place, and run RANSAC/MSAC on these points with a smaller threshold. Finally, fit a line to the inlier-set as usual, e.g. using OpenCV's cvFitLine().

Dr.D.
  • 477
  • 3
  • 11
-1

Here's an article about the Randomized Hough Transform which i believe to be the same as the "probabilistic Hough transform" used in OpenCV http://en.wikipedia.org/wiki/Randomized_Hough_Transform

basically, you dont fill up the accumulator for all points but choose a set of points with a certain criteria to fill up the Hough transform.

The consequence is that sometimes, you could miss the actual line if there wasnt eenough points ot start with. I guess you'd want to use this if you have somewhat linear structures so that most points would be redundant. reference no 2: L. Xu, E. Oja, and P. Kultanan, "A new curve detection method: Randomized Hough transform (RHT)", Pattern Recog. Lett. 11, 1990, 331-338.

I also read about some pretty different approaches where the algorithms would take two points and compute the point in the middle of those two points. if the point is an edge point, then we'd accumulate the bin for that line. This is apparently extremely fast but you'd assume a somewhat non-sparse matrix as you could easily miss lines if there wasnt enough edge points to start with.

Denis
  • 664
  • 9
  • 24
  • very useful comments! Thanks! I didn't look into the lines of randomized approaches, rather, I thought it should be something like "probabilistic Hough transform" or so. – galactica Dec 15 '10 at 20:12
  • 5
    The Randomized Hough Transform is different from the Progressive Probabilistic Hough Transform. The former takes tuples of random points that map into single cells in Hough space. It does this iteratively, and lines/planes are detected as soon as an accumulator cell crosses a threshold. The latter has a filtering mechanism to get rid of noise by considering the percentage of votes of the total number of votes that vote for a cell. See: "The 3D Hough Transform for Plane Detection in Point Clouds: A Review and a new Accumulator Design" by Borrmann et al. (2011) – Anne van Rossum May 02 '13 at 11:47
  • 1
    Don't understand why this is the accepted answer? It has little, if anything, to do with the OpenCV implementation, which as mentioned above implements the Progressive Probabilistic Hough Transform rather than the Randomized Hough Transform. – Dr.D. Mar 20 '14 at 20:00