title: OpenCV line detection for 45 degree lines
body: <p>I have an image:</p>
  
  <p><a href="https://i.stack.imgur.com/MQzqK.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MQzqK.jpg" alt="original image where opencv houghP transform can&#39;t find the -45 degree line"></a></p>
  
  <p>In this image, the OpenCV Hough transform can't detect the big -45 degree line using</p>
  
  <pre><code>minLineLength = 150 
  maxLineGap = 5 
  line_thr = 150 
  linesP = cv.HoughLinesP(dst, 1, np.pi / 180, line_thr, None, minLineLength, maxLineGap) 
  </code></pre>
  
  <p>The only lines found are:</p>
  
  <p><a href="https://i.stack.imgur.com/gXYiT.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gXYiT.jpg" alt="lines found"></a></p>
  
  <p>I tried playing with various thresholds also but I can't find the line here. </p>
  
  <p>If I manually crop the image like this:</p>
  
  <p><a href="https://i.stack.imgur.com/o6Dez.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o6Dez.png" alt="cropped version where line is found"></a></p>
  
  <p>then I can clearly see the OpenCV Hough transform finding the right line:</p>
  
  <p><a href="https://i.stack.imgur.com/pCBWh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pCBWh.jpg" alt="line found"></a></p>
  
  <p>I want to find this same line in the non cropped version. Any suggestions on the non-cropped version to find it?</p>
  
  <p>Also there can be cases where there is no line at all or the line doesn't go all the way for X-axis length. 
  Examples</p>
  
  <p><a href="https://i.stack.imgur.com/mTLEH.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mTLEH.jpg" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/EJtab.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EJtab.jpg" alt="enter image description here"></a></p>