1 | initial version |
there are several errors in your code, first, cv2.findHomography returns a tuple, see:
>>> help(cv2.findHomography)
findHomography(srcPoints, dstPoints[, method[, ransacReprojThreshold[, mask[, maxIters[, confidence]]]]]) -> retval, mask
and you need ONLY the retval (the actual transform matrix)
then, this is entirely broken:
dst = cv2.perspectiveTransform(cv2.UMat(pts, homography))
you don't need a UMat at all, and there is no constructor for it taking 2 arrays. in the end, it should work like this:
# mask is unused
homography, mask = cv2.findHomography(src_pts, dst_pts, cv2.RANSAC, 5.0)
dst = cv2.perspectiveTransform(pts, homography)