title: How To Filter Hough Lines For Multi-lane Detection?
body: <p>I am using HoughTransformP to do lane detection in OpenCV C++.</p>
  
  <p>My sequence of steps for line detection is basic and goes as follows:</p>
  
  <pre><code>1. Bird Eye View of image
  2. Grayscale image
  3. Guassian Blur image
  4. Canny Edge detection
  5. HoughTransformP canny image
  6. Filter out horizontal lines based on the slope
  </code></pre>
  
  <p>The output after canny edge detection is:</p>
  
  <p><a href="https://i.stack.imgur.com/4tt4v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4tt4v.png" alt="enter image description here"></a></p>
  
  <p><strong>The problem here is HougLinesP gives multiple lines, not just the lanes.</strong> The output looks something similar to this:</p>
  
  <p><a href="https://i.stack.imgur.com/6wKPD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6wKPD.png" alt="enter image description here"></a>   </p>
  
  <p>I am trying to obtain something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/AoeY1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AoeY1.png" alt="enter image description here"></a></p>
  
  <p><strong>How do I filter the clutter of lines and draw only lane lines?</strong></p>