title: Apply filters to Hough Line Detection
body: <p>In my application, I use Hough Line Detection to detect lines inside an image. What I'm trying to do is to retrieve only the lines that compose the border and the corners of each square of the chessboard. How can I apply filters to obtain a clear view of the lines?
  My idea is to apply filters to check the angle between each line(90 degrees) or the distance to get only the lines that count. The final goal will be to obtain the intersection between these lines to get the coordinates of each square.</p>
  <p>Code:</p>
  <pre><code>chessBoard = cv2.imread('img.png')
  gray = cv2.cvtColor(chessBoard,cv2.COLOR_BGR2GRAY)
  dst = cv2.Canny(gray, 50, 200)
  lines= cv2.HoughLines(dst, 1, math.pi/180.0, 100, np.array([]), 0, 0)
  a,b,c = lines.shape
  for i in range(a):
      rho = lines[i][0][0]
      theta = lines[i][0][1]
      a = math.cos(theta)
      b = math.sin(theta)
      x0, y0 = a*rho, b*rho
      pt1 = ( int(x0+1000*(-b)), int(y0+1000*(a)) )
      pt2 = ( int(x0-1000*(-b)), int(y0-1000*(a)) )
      cv2.line(chessBoard, pt1, pt2, (0, 255, 0), 2, cv2.LINE_AA)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/PvG54.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PvG54.jpg" alt="enter image description here" /></a></p>