How to use cv2.perspectiveTransform
to apply homography on a set of points in Python OpenCV?
cv2.error: OpenCV(4.0.0) C:\projects\opencv-python\opencv\modules\core\src\matmul.cpp:2270: error: (-215:Assertion failed) scn + 1 == m.cols in function 'cv::perspectiveTransform
Solution: 1
Make sure the pts shape is (n, 1, 2) or (1,n,2):
pts = np.float32(pts).reshape(-1,1,2)
#pts = np.array([pts], np.float32)
cv2.perspectiveTransform(pts, M)