title: Draw line between two given points (OpenCV, Python)
body: <p>I am struggling with this problem for an hour by now...</p>
  
  <p>I have an image with a rectangle inside:</p>
  
  <p><a href="https://i.stack.imgur.com/X7uo1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/X7uo1.png" alt="rect"></a> </p>
  
  <p>This is the code I wrote to find the points for the corners:</p>
  
  <pre><code>import cv2
  import numpy as np
  
  
  img = cv2.imread('rect.png')
  gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  gray = np.float32(gray)
  
  points = cv2.goodFeaturesToTrack(gray, 100, 0.01, 10)
  points = np.int0(points)
  
  for point in points:
      x, y = point.ravel()
      cv2.circle(img, (x, y), 3, (0, 255, 0), -1)
  
  print(points[0])
  print(points[1])
  print(points[2])
  print(points[3])
  
  cv2.imshow('img', img)
  cv2.waitKey(0)
  cv2.imwrite('rect.png', img)
  </code></pre>
  
  <p>This is the result:</p>
  
  <p><a href="https://i.stack.imgur.com/VjUpn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VjUpn.png" alt="rst"></a></p>
  
  <p>As you can see, it works perfect. What I want is to draw a line along the upper/lower points (x1,x2 - x3,x4).</p>
  
  <p>What I produced since now is this...</p>
  
  <pre><code>cv2.line(img, (points[0]), (points[1]), (0, 255, 0), thickness=3, lineType=8)
  
  cv2.imshow('img', img)
  cv2.waitKey(0)
  </code></pre>
  
  <p>But it doesn't work.</p>
  
  <p>Any idea ?</p>
  
  <p>The result should be like this:</p>
  
  <p><a href="https://i.stack.imgur.com/btxIY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/btxIY.png" alt="out"></a></p>
  
  <p>The two lines must pass along the coordinates of the points. <code>print(points[0])</code> above give the next output, as example:</p>
  
  <pre><code>[[561 168]]
  [[155 168]]
  [[561  53]]
  [[155  53]] 
  </code></pre>
  
  <p>Thanks</p>