I found the Homography matrix following the Feature Matching + Homography tutorial using
M, mask = cv2.findHomography(src_pts, dst_pts, cv2.RANSAC,5.0)
and now I need to warp the second image (rotated one) to match the keypoints of the first one, so I tried to do with warpPerspective
directly on img2
since we have the Homography matrix already. (They did not use warpPersective in the tutorial)
dst = cv2.warpPerspective(img2, M)
and it complains that I'm missing the third argument
TypeError: Required argument 'dsize' (pos 3) not found
Fair enough, I checked what dsize
is in the docs, and it seems it's the destination image size. Well, it could be inferred if not given, but opencv is expecting it, (grrr... fine opencv, I'll give you that). I tried again
dst = cv2.warpPerspective(img2, M, img2.shape)
and it throws
TypeError: function takes exactly 2 arguments (3 given)
Wait, didn't I try it with 2 arguments just a minute ago?
What's wrong?