12
votes

In OpenCV, there are two methods of detecting lines that give similar results in the form of a vector of endpoints - the Line Segments Detector (LSD) and the Probabilistic Hough Transform. (Discounting the standard Hough transform as the output given is in terms of equations, not line endpoints.)

I haven't been able to find a compare and contrast of these two line detection methods and their pros/cons. Thus - what is the difference between these two functions? Are there any particular benefits to using one method as opposed to the other?

Additionally, are there other lesser-known line detection methods (like LSD) that might be advantageous in some use cases?

1
LSD uses grayscale image as input white PHough uses binary (black and white) image. So they are quite different. I like LSD for quite parameter free more-like-edge-detection and PHough to find single longer lines.Micka
@Micka you could have mentioned it as answer. I guess it would suffice. Thanks anyway !!!!Jeru Luke
@Micka Agreed, if you wanted to elaborate that into an answer, that'd be great! (Otherwise I guess I'll pull what I do know into an answer at some point and credit you for those points.)ELRG
atm no time to write a nice answer and my comment was a bit opinion based (except the difference binary input vs. grayscale input). Feel free to start an answer yourself and keep it up to date. I'm intetested in differebmnt opinions and hints :)Micka
As Line Segment Detector has been removed due to license conflict, I suggest you all add a thumbs-up to this issue! "Restore LineSegmentDetector LSD & avoid license conflict": github.com/opencv/opencv_contrib/issues/2524#issue-615242133Jean-Christophe

1 Answers

17
votes

Line Segments Detector (LSD)

(Progressive) Probabilistic Hough Transform

  • Takes a binary image as input
  • Has several tuning parameters; distance resolution (rho), angle resolution (theta), an accumulator threshold parameter (only those with enough votes are returned), minimum line length and maximum line gap
  • Time performance depends on parameters (but is improved over standard Hough transform)
  • Several runs may yield different results due to randomised nature
  • Useful for more specific line finding; parameters allow for tuning, and has option to combine segments (via maximum line gap parameter) to return single longer lines
  • The OpenCV implementation is the Progressive Probabilistic Hough Transform (with thanks to Dr. D.'s answer on this question)

Other algorithms

  • EDLines: a linear time line segment detector that utilises an edge detector. No OpenCV implementation as far as I know.

(With thanks to Micka's comment for pointing out the differences in input and potential uses)