Obtain the location and rotation info from DMatch list in OpenCV?

I have successfully obtained a valid DMatch list which I can view with:

    match_drawing = cv2.drawMatchesKnn(g_fiducial, kp1, g_img, kp2, good, None, flags=cv2.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)

The [keypoint documentation][1] describes the DMatch object as:

The result of matches = bf.match(des1,des2) line is a list of DMatch objects. This DMatch object has following attributes:

  • DMatch.distance - Distance between descriptors. The lower, the better it is.
  • DMatch.trainIdx - Index of the descriptor in train descriptors
  • DMatch.queryIdx - Index of the descriptor in query descriptors
  • DMatch.imgIdx - Index of the train image.

I think I've got it, somewhat. I can use some ideas from topology and linear algebra to recover or interpolate the centroid of the template image via a technique that is topologically invariant over a metrical mapping (distance preserving mapping).

But, although I would like to write that code, there must be an easy function to perform this operation in open-cv, and I am missing the search terms necessary to discover it.


Is there a method or "way" to obtain the location/rotation information from a set of DMatch objects obtained, for example, from cv2.BFMatcher()?

[1]: https://docs.opencv.org/master/d2/d29/classcv_1_1KeyPoint.html#:~:text=The%20keypoint%20is%20characterized%20by,represented%20as%20a%20feature%20vector).