I did image registration between two images (img_source, img_ref) using the following code.
# Find homography
h, mask = cv2.findHomography(points1, points2, cv2.RANSAC)
# Use homography
height, width, channels = im2.shape
im1Reg = cv2.warpPerspective(img_source, h, (width, height))
It works perfectly. Then I want to know the location of some specific point (say point (x,y) on img_source) on registered_image (say, (x,y) on im1Reg). Following the explanation of warPerspective on the OpenCV website, I apply the following equation:
x=(M11x0+M12y0+M13)/(M31x0+M32y0+M33) y=(M21x0+M22y0+M23)/(M31x0+M32y0+M33)
where M_{i,j} is the entry of the transformation matrix h.
However, the resulting (x,y) is incorrect (mismatching). Any suggestions here?
Thanks!