title: Unable to locate the lines using hough transform using opencv
body: <p>I want to find lines in the following image using hough transform and I am failing miserably. Could somebody tell where the problem is?</p>
  
  <p>I am using the standard code from opencv.</p>
  
  <p>I am using python and opencv 2.4.2</p>
  
  <p>Findings:</p>
  
  <ol>
  <li>these lines of rectangles are very jaggy</li>
  <li>the edge detection finds broken edges</li>
  <li>even you specify the parameter to connect to fill the gap it does not help.</li>
  </ol>
  
  <p>Thanks a lot.</p>
  
  <p><img src="https://i.stack.imgur.com/VpM7Y.png" alt="Image for the line detection"></p>
  
  <p><strong>EDIT</strong>
  As suggested by "jpa" the image is inverted and the edge detection step is skipped as well</p>
  
  <p>Here is the image after inversion</p>
  
  <p><img src="https://i.stack.imgur.com/5jP74.png" alt="enter image description here"></p>
  
  <p>The parameter used are as follows</p>
  
  <pre><code>    HoughLinesP(image,10, math.pi/2 ,10       ,None ,1000,          1)
      HoughLinesP(image,rho, theta    ,threshold,lines,minLineLength, maxLineGap)
  </code></pre>
  
  <p>The output is the following where red color shows the presence of line.</p>
  
  <p><img src="https://i.stack.imgur.com/u5o2N.jpg" alt="enter image description here"></p>