Last active
October 27, 2020 15:53
-
-
Save emnak/5ae2637c9ee08d9620ed21215441ee25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Select good matched keypoints | |
ref_matched_kpts = np.float32([kp1[m[0].queryIdx].pt for m in good_matches]) | |
sensed_matched_kpts = np.float32([kp2[m[0].trainIdx].pt for m in good_matches]) | |
# Compute homography | |
H, status = cv.findHomography(sensed_matched_kpts, ref_matched_kpts, cv.RANSAC,5.0) | |
# Warp image | |
warped_image = cv.warpPerspective(img2, H, (img2.shape[1], img2.shape[0])) | |
cv.imwrite('warped.jpg', warped_image) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment