Why do we get less amount of lines then desired in line detection using HoughLines tranformation from OpenCV? How could we improve this method and get all the lines appearing in the image? I would still use HoughLines if probable.

  • $\begingroup$ Sorry, it's unclear what you're asking, even after I, after the fourth time reading it, realized that your "no" is not the English word "no", but an abbreviation of "number" (which there was absolutely no need to abbreviate). 1: So, in what special case is this happening? 2: What did you expect? 3: What happened instead? 4: Where's the exact algorithm you're using that uses OpenCV's houghlines? 5: Where's the images on which you're working? Voting to close as unclear until you answer all (not just a part of) 1–5. $\endgroup$ Jan 10, 2018 at 12:18
  • $\begingroup$ Agreeing to @MarcusMüller, I have slightly edited your question and provided a response below. Even though what you are asking is pretty vague, I believe that there could still be a systematic approach that you can employ for better results. $\endgroup$ Jan 10, 2018 at 12:30

1 Answer 1


The performance of line detectors are image and application dependent in generally. Typically, people tune the parameters of the detectors to get the best possible result. When such a result cannot be obtained, it is often because of the insufficient performance of the detector for the current problem. One approach would be to change the algorithm. For instance, OpenCV also has an LSD line segment detector. Have you tried that? Maybe it can also be used in combination with Hough lines.

Having said all those, I would also look at the hardware/system related issues, if they are under your control: Smartly selecting system parameters such as lighting, cameras and lenses generally solve half of the problem. If you would like to operate in the wild, then I would suggest more sophisticated software solutions.

Edit: This question looks very similar to the one recently posted: MatLab - Can not detect all lines in a "simple" image using houghlines

Maybe this could help you out.


Not the answer you're looking for? Browse other questions tagged or ask your own question.