I am using the function findHomography of OpenCV with the RANSAC method in order to find the homography that relates two images linked with a set of keypoints.
I used the findHomography method after applying keypoint matching.
Then you can use the mask output to extract the subset of correct matches from all matches.
There is an example in Python 3.6 & OpenCV 3.4.1:
good_kp = [gray_kp[m.queryIdx].pt for m in good_matches]
correct_matched_kp = [good_kp[i] for i in range(len(good_kp)) if mask[i]]