title: Python OpenCV - how to find ONLY rotation and translation needed to align two images given two sets of points? (no Affine, no warping)
body: <p>I have two sets of matching points, eg.</p>
  
  <pre><code># first set of points
  [[696.0, 971.3333333333334], [1103.3333333333333, 934.6666666666666], ...]
  # second set of points
  [[475.0, 458.6666666666667], [1531.3333333333333, 524.0], ...]
  </code></pre>
  
  <p>from two images. Right now I'm using this piece of code to align images:</p>
  
  <pre><code>points_source = np.array(source_coordinates)
  points_destination = np.array(destination_coordinates)
  
  h, status = cv2.findHomography(points_destination, points_source, cv2.RANSAC)
  aligned_image = cv2.warpPerspective(destination_image, h, (source_image.shape[1], source_image.shape[0]))
  </code></pre>
  
  <p>It works well most of the time, but sometimes it warps image and it aligns bad. I found <code>estimateRigidTransform</code> function, that'd be the best for me, because it's possible to only translate and rotate the image, but it's deprecated and when I try to use it, it throws an error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "align.py", line 139, in &lt;module&gt;
      align(image, image2, source_coordinates, destination_coordinates)
    File "align.py", line 111, in align
      m = cv2.estimateRigidTransform(points_destination, points_source, fullAffine=False)
  AttributeError: module 'cv2' has no attribute 'estimateRigidTransform'
  </code></pre>
  
  <p>I couldn't find any other solution than <code>estimateRigidTransform</code>. Is there any other function that'd work for me? Maybe I can use <code>warpPerspective</code> to only change rotation and translation? I don't want to use <code>getAffineTransform</code> function because it can accept only three points and I want to use much more points. My OpenCV version is <code>4.0.1-1</code></p>