title: why hough transform detects two lines while there is only one line
body: <p>I would like to detect a line and extract its two ended points. The common approach is using the hough transform. Luckily there is a <a href="http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.html" rel="nofollow noreferrer">sample</a> in OpenCV regarding is matter, therefore I've drawn a line whose two ended points <code>p1(100,200), p2(400,200)</code>. I thought the aforementioned method will provid me with only these points. My sample image is </p>
  
  <p><img src="https://i.stack.imgur.com/Cp86U.png" alt="enter image description here"></p>
  
  <p>the hough transform provides me with two images which are </p>
  
  <p><img src="https://i.stack.imgur.com/4dOao.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/fVo29.png" alt="enter image description here"></p>
  
  <p>For Canny filter, </p>
  
  <p><img src="https://i.stack.imgur.com/2sRh9.png" alt="enter image description here"></p>
  
  <p>In the code, it seems that there are two lines are detected. This explains why the red line is thicker which indicates the fact that there are two lines rather than one. When I print out the number of lines, it shows me two as follows </p>
  
  <pre><code>lines.size(): 2
  p1:&lt;99,201&gt;  p2:&lt;401,201&gt;
  lines.size(): 2
  p1:&lt;102,198&gt;  p2:&lt;398,198&gt;
  </code></pre>
  
  <p>Why I'm getting two lines?</p>